Added path_derivatives for Photos 5, issue #50

This commit is contained in:
Rhet Turnbull
2021-05-08 15:11:59 -07:00
parent b23cfa32bb
commit 63834ab8ab
14 changed files with 113 additions and 5 deletions

View File

@@ -496,6 +496,24 @@ def test_path_edited2(photosdb):
assert path is None
def test_path_derivatives(photosdb):
# test an path_derivatives
photos = photosdb.photos(uuid=[UUID_DICT["no_adjustments"]])
assert len(photos) == 1
p = photos[0]
path = p.path_derivatives
derivs = sorted(
[
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_105_c.jpeg",
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_100_o.jpeg",
]
)
path = sorted(path)
for i, p in enumerate(path):
assert p.endswith(derivs[i])
def test_count(photosdb):
photos = photosdb.photos()
assert len(photos) == PHOTOS_NOT_IN_TRASH_LEN

View File

@@ -556,6 +556,24 @@ def test_path_edited2(photosdb):
assert path is None
def test_path_derivatives(photosdb):
# test an path_derivatives
photos = photosdb.photos(uuid=[UUID_DICT["no_adjustments"]])
assert len(photos) == 1
p = photos[0]
path = p.path_derivatives
derivs = sorted(
[
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_105_c.jpeg",
"D05A5FE3-15FB-49A1-A15D-AB3DA6F8B068_1_100_o.jpeg",
]
)
path = sorted(path)
for i, p in enumerate(path):
assert p.endswith(derivs[i])
def test_ismovie(photosdb):
# test ismovie == True

View File

@@ -419,6 +419,16 @@ def test_path_edited1(photosdb):
assert os.path.exists(path)
def test_path_derivatives(photosdb):
# test path_derivatives (not currently implemented for Photos <= 4)
import os.path
photos = photosdb.photos(uuid=[UUID_DICT["has_adjustments"]])
p = photos[0]
path = p.path_derivatives
assert path == []
def test_path_edited2(photosdb):
# test an invalid edited path
photos = photosdb.photos(uuid=[UUID_DICT["no_adjustments"]])