Added path_edited() for Photos 5, still needs to be added for Photos <= 4.0

This commit is contained in:
Rhet Turnbull
2019-11-29 08:47:11 -08:00
parent 3dc0943453
commit 68eef42599
6 changed files with 169 additions and 22 deletions

View File

@@ -216,7 +216,7 @@ def test_hasadjustments1():
photos = photosdb.photos(uuid=["E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51"])
assert len(photos) == 1
p = photos[0]
assert p.hasadjustments() == True
assert p.hasadjustments() == True
def test_hasadjustments2():
@@ -230,6 +230,32 @@ def test_hasadjustments2():
assert p.hasadjustments() == False
def test_path_edited1():
# test a valid edited path
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=["E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51"])
assert len(photos) == 1
p = photos[0]
path = p.path_edited()
assert path.endswith(
"resources/renders/E/E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51_1_201_a.jpeg"
)
def test_path_edited2():
# test an invalid edited path
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=["6191423D-8DB8-4D4C-92BE-9BBBA308AAC4"])
assert len(photos) == 1
p = photos[0]
path = p.path_edited()
assert path is None
def test_count():
import osxphotos

View File

@@ -182,7 +182,7 @@ def test_not_hidden():
def test_location_1():
#test photo with lat/lon info
# test photo with lat/lon info
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
@@ -193,6 +193,7 @@ def test_location_1():
assert lat == pytest.approx(51.50357167)
assert lon == pytest.approx(-0.1318055)
def test_location_2():
# test photo with no location info
import osxphotos
@@ -202,9 +203,60 @@ def test_location_2():
assert len(photos) == 1
p = photos[0]
lat, lon = p.location()
assert lat is None
assert lat is None
assert lon is None
def test_hasadjustments1():
# test hasadjustments == True
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=["6bxcNnzRQKGnK4uPrCJ9UQ"])
assert len(photos) == 1
p = photos[0]
assert p.hasadjustments() == True
def test_hasadjustments2():
# test hasadjustments == False
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=["15uNd7%8RguTEgNPKHfTWw"])
assert len(photos) == 1
p = photos[0]
assert p.hasadjustments() == False
def test_path_edited1():
# test a valid edited path
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=["6bxcNnzRQKGnK4uPrCJ9UQ"])
assert len(photos) == 1
p = photos[0]
path = p.path_edited()
assert path is None
# TODO: update when implemented
# assert path.endswith(
# "resources/renders/E/E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51_1_201_a.jpeg"
# )
def test_path_edited2():
# test an invalid edited path
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=["15uNd7%8RguTEgNPKHfTWw"])
assert len(photos) == 1
p = photos[0]
path = p.path_edited()
assert path is None
def test_count():
import osxphotos