Added tests for PhotoInfo.__repr__

This commit is contained in:
Rhet Turnbull
2019-12-27 16:36:15 -08:00
parent 588ba4b9cb
commit e4d700fcff
2 changed files with 33 additions and 3 deletions

View File

@@ -760,7 +760,6 @@ def test_photosdb_repr():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
print(repr(photosdb))
photosdb2 = eval(repr(photosdb))
ignore_keys = ["_tmp_db", "_tmp_files"]
@@ -768,3 +767,20 @@ def test_photosdb_repr():
k: v for k, v in photosdb2.__dict__.items() if k not in ignore_keys
}
def test_photosinfo_repr():
import osxphotos
import datetime
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(uuid=[UUID_DICT["favorite"]])
photo = photos[0]
photo2 = eval(repr(photo))
assert {
k: str(v).encode("utf-8")
for k, v in photo.__dict__.items()
} == {
k: str(v).encode("utf-8")
for k, v in photo2.__dict__.items()
}