diff --git a/README.md b/README.md
index 7aa8594e..638b5dd0 100644
--- a/README.md
+++ b/README.md
@@ -1354,7 +1354,7 @@ Returns the universally unique identifier (uuid) of the album. This is how Phot
Returns the title or name of the album.
#### `photos`
-Returns a list of [PhotoInfo](#PhotoInfo) objects representing each photo contained in the album.
+Returns a list of [PhotoInfo](#PhotoInfo) objects representing each photo contained in the album sorted in the same order as in Photos. (e.g. if photos were manually sorted in the Photos albums, photos returned by `photos` will be in same order as they appear in the Photos album)
#### `folder_list`
Returns a hierarchical list of [FolderInfo](#FolderInfo) objects representing the folders the album is contained in. For example, if album "AlbumInFolder" is in SubFolder2 of Folder1 as illustrated below, would return a list of `FolderInfo` objects representing ["Folder1", "SubFolder2"]
diff --git a/osxphotos/_version.py b/osxphotos/_version.py
index 08182e61..317a83e6 100644
--- a/osxphotos/_version.py
+++ b/osxphotos/_version.py
@@ -1,3 +1,3 @@
""" version info """
-__version__ = "0.30.8"
+__version__ = "0.30.9"
diff --git a/osxphotos/albuminfo.py b/osxphotos/albuminfo.py
index 5ca86c4a..8a59c06c 100644
--- a/osxphotos/albuminfo.py
+++ b/osxphotos/albuminfo.py
@@ -48,8 +48,13 @@ class AlbumInfo:
try:
return self._photos
except AttributeError:
- uuid = self._db._dbalbums_album[self._uuid]
+ uuid, sort_order = zip(*self._db._dbalbums_album[self.uuid])
self._photos = self._db.photos(uuid=uuid)
+ # PhotosDB.photos does not preserve order when passing in list of uuids
+ # so need to build photo list one a time
+ # sort uuids by sort order
+ sorted_uuid = sorted(zip(sort_order, uuid))
+ self._photos = [self._db.photos(uuid=[uuid])[0] for _, uuid in sorted_uuid]
return self._photos
@property
diff --git a/osxphotos/photosdb/photosdb.py b/osxphotos/photosdb/photosdb.py
index cc1bfa46..d1dcc4be 100644
--- a/osxphotos/photosdb/photosdb.py
+++ b/osxphotos/photosdb/photosdb.py
@@ -167,8 +167,8 @@ class PhotosDB:
self._dbalbums_pk = {}
# Dict with information about all albums/photos by album
- # key is album UUID, value is list of photo UUIDs contained in that album
- # e.g. {'0C514A98-7B77-4E4F-801B-364B7B65EAFA': ['1EB2B765-0765-43BA-A90C-0D0580E6172C']}
+ # key is album UUID, value is list of tuples of (photo UUID, sort order) contained in that album
+ # e.g. {'0C514A98-7B77-4E4F-801B-364B7B65EAFA': [('1EB2B765-0765-43BA-A90C-0D0580E6172C', 1024)]}
self._dbalbums_album = {}
# Dict with information about album details
@@ -627,22 +627,34 @@ class PhotosDB:
# Get info on albums
c.execute(
- """ select
+ """ SELECT
RKAlbum.uuid,
- RKVersion.uuid
- from RKAlbum, RKVersion, RKAlbumVersion
- where RKAlbum.modelID = RKAlbumVersion.albumId and
- RKAlbumVersion.versionID = RKVersion.modelId
+ RKVersion.uuid,
+ RKCustomSortOrder.orderNumber
+ FROM RKVersion
+ JOIN RKCustomSortOrder on RKCustomSortOrder.objectUuid = RKVersion.uuid
+ JOIN RKAlbum on RKAlbum.uuid = RKCustomSortOrder.containerUuid
"""
)
+
+ # 0 RKAlbum.uuid,
+ # 1 RKVersion.uuid,
+ # 2 RKCustomSortOrder.orderNumber
+
for album in c:
# store by uuid in _dbalbums_uuid and by album in _dbalbums_album
- if not album[1] in self._dbalbums_uuid:
- self._dbalbums_uuid[album[1]] = []
- if not album[0] in self._dbalbums_album:
- self._dbalbums_album[album[0]] = []
- self._dbalbums_uuid[album[1]].append(album[0])
- self._dbalbums_album[album[0]].append(album[1])
+ album_uuid = album[0]
+ photo_uuid = album[1]
+ sort_order = album[2]
+ try:
+ self._dbalbums_uuid[photo_uuid].append(album_uuid)
+ except KeyError:
+ self._dbalbums_uuid[photo_uuid] = [album_uuid]
+
+ try:
+ self._dbalbums_album[album_uuid].append((photo_uuid, sort_order))
+ except KeyError:
+ self._dbalbums_album[album_uuid] = [(photo_uuid, sort_order)]
# now get additional details about albums
c.execute(
@@ -1459,22 +1471,34 @@ class PhotosDB:
# get details about albums
c.execute(
- "SELECT ZGENERICALBUM.ZUUID, ZGENERICASSET.ZUUID "
- "FROM ZGENERICASSET "
- "JOIN Z_26ASSETS ON Z_26ASSETS.Z_34ASSETS = ZGENERICASSET.Z_PK "
- "JOIN ZGENERICALBUM ON ZGENERICALBUM.Z_PK = Z_26ASSETS.Z_26ALBUMS "
+ """ SELECT
+ ZGENERICALBUM.ZUUID,
+ ZGENERICASSET.ZUUID,
+ Z_26ASSETS.Z_FOK_34ASSETS
+ FROM ZGENERICASSET
+ JOIN Z_26ASSETS ON Z_26ASSETS.Z_34ASSETS = ZGENERICASSET.Z_PK
+ JOIN ZGENERICALBUM ON ZGENERICALBUM.Z_PK = Z_26ASSETS.Z_26ALBUMS
+ """
)
+
+ # 0 ZGENERICALBUM.ZUUID,
+ # 1 ZGENERICASSET.ZUUID,
+ # 2 Z_26ASSETS.Z_FOK_34ASSETS
+
for album in c:
# store by uuid in _dbalbums_uuid and by album in _dbalbums_album
+ album_uuid = album[0]
+ photo_uuid = album[1]
+ sort_order = album[2]
try:
- self._dbalbums_uuid[album[1]].append(album[0])
+ self._dbalbums_uuid[photo_uuid].append(album_uuid)
except KeyError:
- self._dbalbums_uuid[album[1]] = [album[0]]
+ self._dbalbums_uuid[photo_uuid] = [album_uuid]
try:
- self._dbalbums_album[album[0]].append(album[1])
+ self._dbalbums_album[album_uuid].append((photo_uuid, sort_order))
except KeyError:
- self._dbalbums_album[album[0]] = [album[1]]
+ self._dbalbums_album[album_uuid] = [(photo_uuid, sort_order)]
# now get additional details about albums
c.execute(
@@ -2379,7 +2403,9 @@ class PhotosDB:
title_set = set()
for album_id in self._dbalbum_titles[album]:
try:
- title_set.update(self._dbalbums_album[album_id])
+ # _dbalbums_album value is list of tuples: [(uuid, sort order)]
+ uuid_in_album, _ = zip(*self._dbalbums_album[album_id])
+ title_set.update(uuid_in_album)
except KeyError:
# an empty album will be in _dbalbum_titles but not _dbalbums_album
pass
diff --git a/tests/Test-10.14.6.photoslibrary/database/RKVersion_searchIndexText.skindex b/tests/Test-10.14.6.photoslibrary/database/RKVersion_searchIndexText.skindex
index 7de13426..f16fff11 100644
Binary files a/tests/Test-10.14.6.photoslibrary/database/RKVersion_searchIndexText.skindex and b/tests/Test-10.14.6.photoslibrary/database/RKVersion_searchIndexText.skindex differ
diff --git a/tests/Test-10.14.6.photoslibrary/database/photos.db b/tests/Test-10.14.6.photoslibrary/database/photos.db
index 2702ad81..cdabc0ac 100644
Binary files a/tests/Test-10.14.6.photoslibrary/database/photos.db and b/tests/Test-10.14.6.photoslibrary/database/photos.db differ
diff --git a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist
index caa7fe16..2c06b90f 100644
--- a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist
+++ b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist
@@ -5,6 +5,6 @@
PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate
2020-04-25T23:54:43Z
PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate
- 2020-06-27T16:03:48Z
+ 2020-07-06T16:39:04Z
diff --git a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb
index 68b388ea..20f03954 100644
Binary files a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb and b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb differ
diff --git a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb
index 804de4e2..7d70f7bd 100644
Binary files a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb and b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb differ
diff --git a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-shm b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-shm
index 4a39015f..fe9ac284 100644
Binary files a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-shm and b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-shm differ
diff --git a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-wal b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-wal
index 73c3ddbb..e69de29b 100644
Binary files a/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-wal and b/tests/Test-10.14.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-wal differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/moments/analysismetadata.plist b/tests/Test-10.14.6.photoslibrary/resources/moments/analysismetadata.plist
index 448f4e0d..a17f4bfd 100644
--- a/tests/Test-10.14.6.photoslibrary/resources/moments/analysismetadata.plist
+++ b/tests/Test-10.14.6.photoslibrary/resources/moments/analysismetadata.plist
@@ -11,6 +11,6 @@
PLLastRevGeoForcedProviderOutOfDateCheckVersionKey
1
PLLastRevGeoVerFileFetchDateKey
- 2020-06-27T16:03:43Z
+ 2020-07-06T16:39:09Z
diff --git a/tests/Test-10.14.6.photoslibrary/resources/moments/historicalmarker.plist b/tests/Test-10.14.6.photoslibrary/resources/moments/historicalmarker.plist
index 1b7dee4c..7334451b 100644
--- a/tests/Test-10.14.6.photoslibrary/resources/moments/historicalmarker.plist
+++ b/tests/Test-10.14.6.photoslibrary/resources/moments/historicalmarker.plist
@@ -3,7 +3,7 @@
LastHistoryRowId
- 651
+ 664
LibraryBuildTag
D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E
LibrarySchemaVersion
diff --git a/tests/Test-10.14.6.photoslibrary/resources/moments/needsanalysis b/tests/Test-10.14.6.photoslibrary/resources/moments/needsanalysis
deleted file mode 100644
index e69de29b..00000000
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/Info.plist b/tests/Test-10.14.6.photoslibrary/resources/recovery/Info.plist
index 8d4db656..dd219b43 100644
--- a/tests/Test-10.14.6.photoslibrary/resources/recovery/Info.plist
+++ b/tests/Test-10.14.6.photoslibrary/resources/recovery/Info.plist
@@ -9,7 +9,7 @@
HistoricalMarker
LastHistoryRowId
- 606
+ 664
LibraryBuildTag
D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E
LibrarySchemaVersion
@@ -24,7 +24,7 @@
SnapshotCompletedDate
2019-07-27T13:16:43Z
SnapshotLastValidated
- 2020-06-27T16:03:33Z
+ 2020-07-06T16:39:02Z
SnapshotTables
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij
index ed99d637..5f848d52 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKCustomSortOrder/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKCustomSortOrder/0000000000.lij
index 66cad110..0e994c1a 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKCustomSortOrder/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKCustomSortOrder/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij
index 53223be6..b5b9516b 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij
index 3304ad99..d5bf8f68 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij
index 66e74bc1..f1557467 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlace/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlace/0000000000.lij
index da4a92be..70d9e495 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlace/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlace/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij
index b8a3dd03..c3aba0e9 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij
index 104d72f3..29a1beff 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij
index fd3ef453..362411ae 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij and b/tests/Test-10.14.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/segments/Thumb64Segment_0.data b/tests/Test-10.14.6.photoslibrary/resources/segments/Thumb64Segment_0.data
index 303b5a0d..6e55d71d 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/segments/Thumb64Segment_0.data and b/tests/Test-10.14.6.photoslibrary/resources/segments/Thumb64Segment_0.data differ
diff --git a/tests/Test-10.14.6.photoslibrary/resources/segments/ThumbJPGSegment_0.data b/tests/Test-10.14.6.photoslibrary/resources/segments/ThumbJPGSegment_0.data
index b661d2db..8fb8e44d 100644
Binary files a/tests/Test-10.14.6.photoslibrary/resources/segments/ThumbJPGSegment_0.data and b/tests/Test-10.14.6.photoslibrary/resources/segments/ThumbJPGSegment_0.data 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 fe9ac284..c5ee28a9 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 e69de29b..dd7a111b 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/Photos.sqlite.lock b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite.lock
index 66af3ae5..654e61b9 100644
--- a/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite.lock
+++ b/tests/Test-10.15.5.photoslibrary/database/Photos.sqlite.lock
@@ -7,7 +7,7 @@
hostuuid
9575E48B-8D5F-5654-ABAC-4431B1167324
pid
- 1613
+ 1743
processname
photolibraryd
uid
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 32b228b0..1e04d109 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/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 695834e2..c86081de 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 13a8a986..891a7c36 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/changetoken.plist b/tests/Test-10.15.5.photoslibrary/private/com.apple.photoanalysisd/caches/graph/changetoken.plist
index b5224a17..735c11c1 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/resources/journals/Album-change.plj b/tests/Test-10.15.5.photoslibrary/resources/journals/Album-change.plj
index 87e13f53..b20737cd 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/HistoryToken.plist b/tests/Test-10.15.5.photoslibrary/resources/journals/HistoryToken.plist
index 3d8cd7ac..1460656c 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_catalina_10_15_5.py b/tests/test_catalina_10_15_5.py
index 04f54f1d..90a90c5a 100644
--- a/tests/test_catalina_10_15_5.py
+++ b/tests/test_catalina_10_15_5.py
@@ -80,6 +80,12 @@ UUID_PUMPKIN_FARM = [
"1EB2B765-0765-43BA-A90C-0D0580E6172C",
]
+ALBUM_SORT_ORDER = [
+"1EB2B765-0765-43BA-A90C-0D0580E6172C",
+"F12384F6-CD17-4151-ACBA-AE0E3688539E",
+"D79B8D77-BFFC-460B-9312-034F2877D35B",
+]
+ALBUM_KEY_PHOTO = "D79B8D77-BFFC-460B-9312-034F2877D35B"
def test_init1():
# test named argument
@@ -217,6 +223,15 @@ def test_albums_as_dict():
assert albums["Pumpkin Farm"] == 3
assert albums == ALBUM_DICT
+def test_album_sort_order():
+ import osxphotos
+
+ photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
+ album = [a for a in photosdb.album_info if a.title == "Pumpkin Farm"][0]
+ photos = album.photos
+
+ uuids = [p.uuid for p in photos]
+ assert uuids == ALBUM_SORT_ORDER
def test_attributes():
import datetime
diff --git a/tests/test_mojave_10_14_6.py b/tests/test_mojave_10_14_6.py
index 5a25cf7a..14f0389c 100644
--- a/tests/test_mojave_10_14_6.py
+++ b/tests/test_mojave_10_14_6.py
@@ -47,6 +47,13 @@ UUID_DICT = {
"has_adjustments": "6bxcNnzRQKGnK4uPrCJ9UQ",
}
+ALBUM_SORT_ORDER = [
+ "HrK3ZQdlQ7qpDA0FgOYXLA",
+ "8SOE9s0XQVGsuq4ONohTng",
+ "15uNd7%8RguTEgNPKHfTWw",
+]
+ALBUM_KEY_PHOTO = "15uNd7%8RguTEgNPKHfTWw"
+
PHOTOS_DB_LEN = 8
PHOTOS_NOT_IN_TRASH_LEN = 7
PHOTOS_IN_TRASH_LEN = 1
@@ -136,6 +143,17 @@ def test_albums_as_dict():
assert albums == ALBUM_DICT
+def test_album_sort_order():
+ import osxphotos
+
+ photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
+ album = [a for a in photosdb.album_info if a.title == "Pumpkin Farm"][0]
+ photos = album.photos
+
+ uuids = [p.uuid for p in photos]
+ assert uuids == ALBUM_SORT_ORDER
+
+
def test_attributes():
import datetime
import osxphotos