Bootstrap project and safe work-item workflow

This commit is contained in:
2026-07-13 13:51:41 +02:00
commit 80447092e9
90 changed files with 10562 additions and 0 deletions

15
test_nsfw_skip.py Normal file
View File

@@ -0,0 +1,15 @@
"""Self-check for photo_analyzer's nsfw-skip parsing. Run: python test_nsfw_skip.py"""
from photo_analyzer import _rec_has_nsfw
def test():
assert _rec_has_nsfw({"Keywords": ["beach", "nsfw"]}) # list, present
assert _rec_has_nsfw({"Subject": "nsfw"}) # scalar in Subject
assert _rec_has_nsfw({"Keywords": "NSFW"}) # case-insensitive
assert _rec_has_nsfw({"Keywords": [" nsfw "]}) # whitespace
assert not _rec_has_nsfw({"Keywords": ["sfw", "beach"]}) # sfw only
assert not _rec_has_nsfw({"Keywords": ["nsfw-ish"]}) # substring != tag
assert not _rec_has_nsfw({}) # no fields
print("ok")
if __name__ == "__main__":
test()