diff --git a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite index 80d4b5be..a8c4e65a 100644 Binary files a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite and b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite differ diff --git a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-shm b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-shm index 15ae3d34..b8232383 100644 Binary files a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-shm and b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-shm differ diff --git a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-wal b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-wal index 411e8368..e9cc904e 100644 Binary files a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-wal and b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite-wal differ diff --git a/tests/Test-10.15.5.photoslibrary/database/search/psi.sqlite b/tests/Test-10.15.5.photoslibrary/database/search/psi.sqlite index bb310c82..256c5336 100644 Binary files a/tests/Test-10.15.5.photoslibrary/database/search/psi.sqlite and b/tests/Test-10.15.5.photoslibrary/database/search/psi.sqlite differ diff --git a/tests/Test-10.15.5.photoslibrary/database/search/zeroKeywords.data b/tests/Test-10.15.5.photoslibrary/database/search/zeroKeywords.data index 849f1031..ca7a6f09 100644 Binary files a/tests/Test-10.15.5.photoslibrary/database/search/zeroKeywords.data and b/tests/Test-10.15.5.photoslibrary/database/search/zeroKeywords.data differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db b/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db index 69a98fb3..9f719ca2 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db and b/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm b/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm index 771f125e..28af3ebf 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm and b/tests/Test-10.15.5.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm index c1cd3636..62a76fe9 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal index df95de56..5dabc7f9 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm index f3af43ab..73656d14 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal index 53eb322e..eab46f86 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm index 9e32a028..a480ef04 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal index 56de43cf..312c4c79 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist index 530f3547..8be6cc7e 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist index 18007d38..6316fd20 100644 --- a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist +++ b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist @@ -3,24 +3,24 @@ BackgroundHighlightCollection - 2020-04-19T15:27:34Z + 2020-05-30T01:45:51Z BackgroundHighlightEnrichment - 2020-04-19T15:27:34Z + 2020-05-30T01:45:51Z BackgroundJobAssetRevGeocode - 2020-04-19T15:27:35Z + 2020-05-30T04:01:24Z BackgroundJobSearch - 2020-04-19T15:27:35Z + 2020-05-30T01:45:51Z BackgroundPeopleSuggestion - 2020-04-19T15:27:34Z + 2020-05-30T01:45:51Z BackgroundUserBehaviorProcessor - 2020-04-19T15:27:35Z + 2020-05-29T04:31:38Z PhotoAnalysisGraphLastBackgroundGraphConsistencyUpdateJobDateKey - 2020-04-11T20:10:27Z + 2020-05-30T02:16:06Z PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate - 2020-04-11T20:00:24Z + 2020-05-29T04:31:37Z PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate - 2020-04-19T15:27:35Z + 2020-05-30T04:01:24Z SiriPortraitDonation - 2020-04-19T15:27:35Z + 2020-05-29T04:31:38Z diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb index 9e703017..5f5c214f 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/changetoken.plist b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/changetoken.plist index e9ba1db9..beb22554 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/changetoken.plist and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/changetoken.plist differ diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist index db8788e1..bdd3d753 100644 --- a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist +++ b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist @@ -3,8 +3,8 @@ FaceIDModelLastGenerationKey - 2020-04-11T20:00:25Z + 2020-05-29T03:44:04Z LastContactClassificationKey - 2020-04-11T20:00:26Z + 2020-05-29T04:31:40Z diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/faceWorkerState.plist b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/faceWorkerState.plist index 736db69d..c36206de 100644 --- a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/faceWorkerState.plist +++ b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/faceWorkerState.plist @@ -3,7 +3,7 @@ IncrementalPersonProcessingStage - 0 + 6 PersonBuilderLastMinimumFaceGroupSizeForCreatingMergeCandidates 15 PersonBuilderMergeCandidatesEnabled diff --git a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin index 13f7d447..211a83f7 100644 Binary files a/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin and b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Album-change.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/Album-change.plj index 25511ade..748b1680 100644 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/Album-change.plj and b/tests/Test-10.15.5.photoslibrary/resources/journals/Album-change.plj differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-change.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-change.plj deleted file mode 100644 index f44e886f..00000000 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-change.plj and /dev/null differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-snapshot.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-snapshot.plj index 2eec5562..5d4b6fe5 100644 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-snapshot.plj and b/tests/Test-10.15.5.photoslibrary/resources/journals/Asset-snapshot.plj differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Asset.plist b/tests/Test-10.15.5.photoslibrary/resources/journals/Asset.plist index 881220b0..43b9c778 100644 --- a/tests/Test-10.15.5.photoslibrary/resources/journals/Asset.plist +++ b/tests/Test-10.15.5.photoslibrary/resources/journals/Asset.plist @@ -2,6 +2,10 @@ + coalesceDate + 2020-05-29T15:20:05Z + coalescePayloadVersion + 10 currentPayloadVersion 10 snapshotDate diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-change.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-change.plj deleted file mode 100644 index 441e1515..00000000 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-change.plj and /dev/null differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-snapshot.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-snapshot.plj index 96b2eed4..71155590 100644 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-snapshot.plj and b/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume-snapshot.plj differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume.plist b/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume.plist index 3ece9a2c..ac1db136 100644 --- a/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume.plist +++ b/tests/Test-10.15.5.photoslibrary/resources/journals/FileSystemVolume.plist @@ -2,6 +2,10 @@ + coalesceDate + 2020-05-29T15:20:05Z + coalescePayloadVersion + 1 currentPayloadVersion 1 snapshotDate diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-change.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-change.plj deleted file mode 100644 index baaac7b0..00000000 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-change.plj and /dev/null differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-snapshot.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-snapshot.plj index d1520b31..2e6a4601 100644 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-snapshot.plj and b/tests/Test-10.15.5.photoslibrary/resources/journals/Folder-snapshot.plj differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/Folder.plist b/tests/Test-10.15.5.photoslibrary/resources/journals/Folder.plist index 523b84b5..ac1db136 100644 --- a/tests/Test-10.15.5.photoslibrary/resources/journals/Folder.plist +++ b/tests/Test-10.15.5.photoslibrary/resources/journals/Folder.plist @@ -3,7 +3,7 @@ coalesceDate - 2020-04-11T19:26:12Z + 2020-05-29T15:20:05Z coalescePayloadVersion 1 currentPayloadVersion diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/HistoryToken.plist b/tests/Test-10.15.5.photoslibrary/resources/journals/HistoryToken.plist index 152c5743..7f5ca8d9 100644 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/HistoryToken.plist and b/tests/Test-10.15.5.photoslibrary/resources/journals/HistoryToken.plist differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-change.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-change.plj deleted file mode 100644 index 452c7b95..00000000 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-change.plj and /dev/null differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-snapshot.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-snapshot.plj index e9748af2..b70f6df4 100644 Binary files a/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-snapshot.plj and b/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession-snapshot.plj differ diff --git a/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession.plist b/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession.plist index 3ece9a2c..ac1db136 100644 --- a/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession.plist +++ b/tests/Test-10.15.5.photoslibrary/resources/journals/ImportSession.plist @@ -2,6 +2,10 @@ + coalesceDate + 2020-05-29T15:20:05Z + coalescePayloadVersion + 1 currentPayloadVersion 1 snapshotDate diff --git a/tests/test_search_info_10_15_5.py b/tests/test_search_info_10_15_5.py new file mode 100644 index 00000000..c15e5c1d --- /dev/null +++ b/tests/test_search_info_10_15_5.py @@ -0,0 +1,287 @@ +""" test PhotoInfo.search_info """ + +import pytest + +from osxphotos._constants import _UNKNOWN_PERSON + + +PHOTOS_DB = "./tests/Test-10.15.5.photoslibrary/database/photos.db" +PHOTOS_DB_PATH = "/Test-10.15.5.photoslibrary/database/photos.db" +PHOTOS_LIBRARY_PATH = "/Test-10.15.5.photoslibrary" + +LABELS_DICT = { + # A92D9C26-3A50-4197-9388-CB5F7DB9FA91 IMG_1994.JPG None RAW + JPEG, JPEG Original [] False + "A92D9C26-3A50-4197-9388-CB5F7DB9FA91": [ + "Blue Sky", + "Outdoor", + "Palm Tree", + "Plant", + "Sky", + "Tree", + ], + # F12384F6-CD17-4151-ACBA-AE0E3688539E Pumkins1.jpg Can we carry this? Girls with pumpkins [] False + "F12384F6-CD17-4151-ACBA-AE0E3688539E": [], + # D79B8D77-BFFC-460B-9312-034F2877D35B Pumkins2.jpg I found one! Girl holding pumpkin [] False + "D79B8D77-BFFC-460B-9312-034F2877D35B": [], + # D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068 DSC03584.dng None RAW only [] False + "D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068": ["Camera"], + # A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C Pumpkins4.jpg Pumpkin heads None [] True + "A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C": [], + # 3DD2C897-F19E-4CA6-8C22-B027D5A71907 IMG_4547.jpg Elder Park ⁨Elder Park⁩, ⁨Adelaide⁩, ⁨Australia⁩ ['Statue', 'Art'] False + "3DD2C897-F19E-4CA6-8C22-B027D5A71907": ["Statue", "Art"], + # 8E1D7BC9-9321-44F9-8CFB-4083F6B9232A IMG_2000.JPG None RAW + JPEG, Not copied to library [] False + "8E1D7BC9-9321-44F9-8CFB-4083F6B9232A": ["Foliage", "Plant"], + # 4D521201-92AC-43E5-8F7C-59BC41C37A96 IMG_1997.JPG None RAW + JPEG, RAW original [] False + "4D521201-92AC-43E5-8F7C-59BC41C37A96": [ + "Decorative Plant", + "Foliage", + "Plant", + "Window", + ], + # 6191423D-8DB8-4D4C-92BE-9BBBA308AAC4 Tulips.jpg Tulips tied together at a flower shop Wedding tulips ['Flower', 'Vase', 'Bouquet', 'Container', 'Art', 'Flower Arrangement', 'Plant'] False + "6191423D-8DB8-4D4C-92BE-9BBBA308AAC4": [ + "Flower", + "Vase", + "Bouquet", + "Container", + "Art", + "Flower Arrangement", + "Plant", + ], + # 1EB2B765-0765-43BA-A90C-0D0580E6172C Pumpkins3.jpg None Kids in pumpkin field [] False + "1EB2B765-0765-43BA-A90C-0D0580E6172C": [], + # DC99FBDD-7A52-4100-A5BB-344131646C30 St James Park.jpg St. James's Park None ['Tree', 'Plant', 'Waterways', 'River', 'Sky', 'Cloudy', 'Land', 'Water Body', 'Water', 'Outdoor'] False + "DC99FBDD-7A52-4100-A5BB-344131646C30": [ + "Tree", + "Plant", + "Waterways", + "River", + "Sky", + "Cloudy", + "Land", + "Water Body", + "Water", + "Outdoor", + ], + # E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51 wedding.jpg None Bride Wedding day [] False + "E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51": [], +} + +LABELS_NORMALIZED_DICT = { + # DC99FBDD-7A52-4100-A5BB-344131646C30 St James Park.jpg St. James's Park None ['tree', 'plant', 'waterways', 'river', 'sky', 'cloudy', 'land', 'water body', 'water', 'outdoor'] False + "DC99FBDD-7A52-4100-A5BB-344131646C30": [ + "tree", + "plant", + "waterways", + "river", + "sky", + "cloudy", + "land", + "water body", + "water", + "outdoor", + ], + # 4D521201-92AC-43E5-8F7C-59BC41C37A96 IMG_1997.JPG None RAW + JPEG, RAW original [] False + "4D521201-92AC-43E5-8F7C-59BC41C37A96": [ + "decorative plant", + "foliage", + "plant", + "window", + ], + # A92D9C26-3A50-4197-9388-CB5F7DB9FA91 IMG_1994.JPG None RAW + JPEG, JPEG Original [] False + "A92D9C26-3A50-4197-9388-CB5F7DB9FA91": [ + "blue sky", + "outdoor", + "palm tree", + "plant", + "sky", + "tree", + ], + # E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51 wedding.jpg None Bride Wedding day [] False + "E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51": [], + # D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068 DSC03584.dng None RAW only [] False + "D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068": ["camera"], + # 8E1D7BC9-9321-44F9-8CFB-4083F6B9232A IMG_2000.JPG None RAW + JPEG, Not copied to library [] False + "8E1D7BC9-9321-44F9-8CFB-4083F6B9232A": ["foliage", "plant"], + # 3DD2C897-F19E-4CA6-8C22-B027D5A71907 IMG_4547.jpg Elder Park ⁨Elder Park⁩, ⁨Adelaide⁩, ⁨Australia⁩ ['statue', 'art'] False + "3DD2C897-F19E-4CA6-8C22-B027D5A71907": ["statue", "art"], + # 6191423D-8DB8-4D4C-92BE-9BBBA308AAC4 Tulips.jpg Tulips tied together at a flower shop Wedding tulips ['flower', 'vase', 'bouquet', 'container', 'art', 'flower arrangement', 'plant'] False + "6191423D-8DB8-4D4C-92BE-9BBBA308AAC4": [ + "flower", + "vase", + "bouquet", + "container", + "art", + "flower arrangement", + "plant", + ], + # D79B8D77-BFFC-460B-9312-034F2877D35B Pumkins2.jpg I found one! Girl holding pumpkin [] False + "D79B8D77-BFFC-460B-9312-034F2877D35B": [], + # F12384F6-CD17-4151-ACBA-AE0E3688539E Pumkins1.jpg Can we carry this? Girls with pumpkins [] False + "F12384F6-CD17-4151-ACBA-AE0E3688539E": [], + # A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C Pumpkins4.jpg Pumpkin heads None [] True + "A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C": [], +} + +SEARCH_INFO_DICT = { + # valid search_info + "DC99FBDD-7A52-4100-A5BB-344131646C30": True, + # missing, so no search_info + "A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C": False, +} + + +LABELS = [ + "Tree", + "Plant", + "Waterways", + "River", + "Sky", + "Cloudy", + "Land", + "Water Body", + "Water", + "Outdoor", + "Statue", + "Art", + "Foliage", + "Window", + "Decorative Plant", + "Blue Sky", + "Palm Tree", + "Flower", + "Flower Arrangement", + "Bouquet", + "Vase", + "Container", + "Camera", +] + +LABELS_NORMALIZED = [ + "tree", + "plant", + "waterways", + "river", + "sky", + "cloudy", + "land", + "water body", + "water", + "outdoor", + "statue", + "art", + "foliage", + "window", + "decorative plant", + "blue sky", + "palm tree", + "flower", + "flower arrangement", + "bouquet", + "vase", + "container", + "camera", +] + +LABELS_AS_DICT = { + "Plant": 5, + "Tree": 2, + "Sky": 2, + "Outdoor": 2, + "Art": 2, + "Foliage": 2, + "Waterways": 1, + "River": 1, + "Cloudy": 1, + "Land": 1, + "Water Body": 1, + "Water": 1, + "Statue": 1, + "Window": 1, + "Decorative Plant": 1, + "Blue Sky": 1, + "Palm Tree": 1, + "Flower": 1, + "Flower Arrangement": 1, + "Bouquet": 1, + "Vase": 1, + "Container": 1, + "Camera": 1, +} + +LABELS_NORMALIZED_AS_DICT = { + "plant": 5, + "tree": 2, + "sky": 2, + "outdoor": 2, + "art": 2, + "foliage": 2, + "waterways": 1, + "river": 1, + "cloudy": 1, + "land": 1, + "water body": 1, + "water": 1, + "statue": 1, + "window": 1, + "decorative plant": 1, + "blue sky": 1, + "palm tree": 1, + "flower": 1, + "flower arrangement": 1, + "bouquet": 1, + "vase": 1, + "container": 1, + "camera": 1, +} + + +@pytest.fixture +def photosdb(): + # return a PhotosDB object for use by tests + import osxphotos + + return osxphotos.PhotosDB(dbfile=PHOTOS_DB) + + +def test_search_info(photosdb): + for uuid in SEARCH_INFO_DICT: + photo = photosdb.photos(uuid=[uuid])[0] + + if SEARCH_INFO_DICT[uuid]: + assert photo.search_info + else: + # still have a search info object but should have no data + assert photo.search_info._db_searchinfo is None + + +def test_labels_normalized(photosdb): + import logging + + for uuid in LABELS_NORMALIZED_DICT: + photo = photosdb.photos(uuid=[uuid])[0] + logging.warning(f"uuid = {uuid}") + assert sorted(photo.search_info.labels_normalized) == sorted( + LABELS_NORMALIZED_DICT[uuid] + ) + assert sorted(photo.labels_normalized) == sorted(LABELS_NORMALIZED_DICT[uuid]) + + +def test_labels(photosdb): + import logging + + for uuid in LABELS_DICT: + logging.warning(f"uuid = {uuid}") + photo = photosdb.photos(uuid=[uuid])[0] + assert sorted(photo.search_info.labels) == sorted(LABELS_DICT[uuid]) + assert sorted(photo.labels) == sorted(LABELS_DICT[uuid]) + + +def test_photosdb_labels(photosdb): + assert sorted(photosdb.labels) == sorted(LABELS) + assert sorted(photosdb.labels_normalized) == sorted(LABELS_NORMALIZED) + + +def test_photosdb_labels_as_dict(photosdb): + assert photosdb.labels_as_dict == LABELS_AS_DICT + assert photosdb.labels_normalized_as_dict == LABELS_NORMALIZED_AS_DICT