Moved PhotosDB attributes to properties instead of methods

This commit is contained in:
Rhet Turnbull
2019-12-21 10:08:49 -08:00
parent 1ddd90cbdc
commit d95acdf9f8
9 changed files with 183 additions and 204 deletions

View File

@@ -43,8 +43,8 @@ def test_db_version():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
assert photosdb.get_db_version() == "2622"
# assert photosdb.db_version in osxphotos._TESTED_DB_VERSIONS
assert photosdb.db_version == "2622"
def test_os_version():
@@ -59,8 +59,8 @@ def test_persons():
import collections
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
assert "Katie" in photosdb.persons()
assert collections.Counter(PERSONS) == collections.Counter(photosdb.persons())
assert "Katie" in photosdb.persons
assert collections.Counter(PERSONS) == collections.Counter(photosdb.persons)
def test_keywords():
@@ -68,8 +68,8 @@ def test_keywords():
import collections
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
assert "wedding" in photosdb.keywords()
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords())
assert "wedding" in photosdb.keywords
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
def test_albums():
@@ -77,15 +77,15 @@ def test_albums():
import collections
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
assert "Pumpkin Farm" in photosdb.albums()
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.albums())
assert "Pumpkin Farm" in photosdb.albums
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.albums)
def test_keywords_dict():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
keywords = photosdb.keywords_as_dict()
keywords = photosdb.keywords_as_dict
assert keywords["wedding"] == 2
assert keywords == KEYWORDS_DICT
@@ -94,7 +94,7 @@ def test_persons_as_dict():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
persons = photosdb.persons_as_dict()
persons = photosdb.persons_as_dict
assert persons["Maria"] == 1
assert persons == PERSONS_DICT
@@ -103,7 +103,7 @@ def test_albums_as_dict():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
albums = photosdb.albums_as_dict()
albums = photosdb.albums_as_dict
assert albums["Pumpkin Farm"] == 3
assert albums == ALBUM_DICT