Updated get_db_version and associated tests
This commit is contained in:
@@ -387,10 +387,7 @@ class PhotosDB:
|
|||||||
c.execute(
|
c.execute(
|
||||||
"SELECT value from LiGlobals where LiGlobals.keyPath is 'libraryVersion'"
|
"SELECT value from LiGlobals where LiGlobals.keyPath is 'libraryVersion'"
|
||||||
)
|
)
|
||||||
for ver in c:
|
version = c.fetchone()[0]
|
||||||
version = ver[0]
|
|
||||||
break # TODO: is there a more pythonic way to do get the first element from cursor?
|
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
if version not in _TESTED_DB_VERSIONS:
|
if version not in _TESTED_DB_VERSIONS:
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ def test_db_version():
|
|||||||
import osxphotos
|
import osxphotos
|
||||||
|
|
||||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
||||||
|
assert photosdb.get_db_version() == "2622"
|
||||||
|
|
||||||
|
|
||||||
def test_os_version():
|
def test_os_version():
|
||||||
@@ -170,36 +171,3 @@ def test_keyword_not_in_album():
|
|||||||
assert len(photos3) == 1
|
assert len(photos3) == 1
|
||||||
assert photos3[0].uuid() == "Pj99JmYjQkeezdY2OFuSaw"
|
assert photos3[0].uuid() == "Pj99JmYjQkeezdY2OFuSaw"
|
||||||
|
|
||||||
|
|
||||||
# def main():
|
|
||||||
# photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
|
||||||
# print(photosdb.keywords())
|
|
||||||
# print(photosdb.persons())
|
|
||||||
# print(photosdb.albums())
|
|
||||||
|
|
||||||
# print(photosdb.keywords_as_dict())
|
|
||||||
# print(photosdb.persons_as_dict())
|
|
||||||
# print(photosdb.albums_as_dict())
|
|
||||||
|
|
||||||
# # # find all photos with Keyword = Foo and containing John Smith
|
|
||||||
# # photos = photosdb.photos(keywords=["Foo"],persons=["John Smith"])
|
|
||||||
# #
|
|
||||||
# # # find all photos that include Alice Smith but do not contain the keyword Bar
|
|
||||||
# # photos = [p for p in photosdb.photos(persons=["Alice Smith"])
|
|
||||||
# # if p not in photosdb.photos(keywords=["Bar"]) ]
|
|
||||||
# photos = photosdb.photos()
|
|
||||||
# for p in photos:
|
|
||||||
# print(
|
|
||||||
# p.uuid(),
|
|
||||||
# p.filename(),
|
|
||||||
# p.date(),
|
|
||||||
# p.description(),
|
|
||||||
# p.name(),
|
|
||||||
# p.keywords(),
|
|
||||||
# p.albums(),
|
|
||||||
# p.persons(),
|
|
||||||
# p.path(),
|
|
||||||
# )
|
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
|
||||||
# main()
|
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ def test_db_version():
|
|||||||
import osxphotos
|
import osxphotos
|
||||||
|
|
||||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
||||||
|
assert photosdb.get_db_version() == "6000"
|
||||||
|
|
||||||
|
|
||||||
def test_os_version():
|
def test_os_version():
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ def test_db_version():
|
|||||||
import osxphotos
|
import osxphotos
|
||||||
|
|
||||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
assert photosdb.get_db_version() == "3301"
|
||||||
|
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
||||||
|
|
||||||
|
|
||||||
def test_os_version():
|
def test_os_version():
|
||||||
@@ -169,36 +170,3 @@ def test_keyword_not_in_album():
|
|||||||
assert len(photos3) == 1
|
assert len(photos3) == 1
|
||||||
assert photos3[0].uuid() == "6iAZJP7ZQ5iXxapoJb3ytA"
|
assert photos3[0].uuid() == "6iAZJP7ZQ5iXxapoJb3ytA"
|
||||||
|
|
||||||
|
|
||||||
# def main():
|
|
||||||
# photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
|
||||||
# print(photosdb.keywords())
|
|
||||||
# print(photosdb.persons())
|
|
||||||
# print(photosdb.albums())
|
|
||||||
|
|
||||||
# print(photosdb.keywords_as_dict())
|
|
||||||
# print(photosdb.persons_as_dict())
|
|
||||||
# print(photosdb.albums_as_dict())
|
|
||||||
|
|
||||||
# # # find all photos with Keyword = Foo and containing John Smith
|
|
||||||
# # photos = photosdb.photos(keywords=["Foo"],persons=["John Smith"])
|
|
||||||
# #
|
|
||||||
# # # find all photos that include Alice Smith but do not contain the keyword Bar
|
|
||||||
# # photos = [p for p in photosdb.photos(persons=["Alice Smith"])
|
|
||||||
# # if p not in photosdb.photos(keywords=["Bar"]) ]
|
|
||||||
# photos = photosdb.photos()
|
|
||||||
# for p in photos:
|
|
||||||
# print(
|
|
||||||
# p.uuid(),
|
|
||||||
# p.filename(),
|
|
||||||
# p.date(),
|
|
||||||
# p.description(),
|
|
||||||
# p.name(),
|
|
||||||
# p.keywords(),
|
|
||||||
# p.albums(),
|
|
||||||
# p.persons(),
|
|
||||||
# p.path(),
|
|
||||||
# )
|
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
|
||||||
# main()
|
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ def test_db_version():
|
|||||||
import osxphotos
|
import osxphotos
|
||||||
|
|
||||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
# assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
||||||
|
assert photosdb.get_db_version() == "4016"
|
||||||
|
|
||||||
|
|
||||||
def test_os_version():
|
def test_os_version():
|
||||||
@@ -169,36 +170,3 @@ def test_keyword_not_in_album():
|
|||||||
assert len(photos3) == 1
|
assert len(photos3) == 1
|
||||||
assert photos3[0].uuid() == "od0fmC7NQx+ayVr+%i06XA"
|
assert photos3[0].uuid() == "od0fmC7NQx+ayVr+%i06XA"
|
||||||
|
|
||||||
|
|
||||||
# def main():
|
|
||||||
# photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
|
||||||
# print(photosdb.keywords())
|
|
||||||
# print(photosdb.persons())
|
|
||||||
# print(photosdb.albums())
|
|
||||||
|
|
||||||
# print(photosdb.keywords_as_dict())
|
|
||||||
# print(photosdb.persons_as_dict())
|
|
||||||
# print(photosdb.albums_as_dict())
|
|
||||||
|
|
||||||
# # # find all photos with Keyword = Foo and containing John Smith
|
|
||||||
# # photos = photosdb.photos(keywords=["Foo"],persons=["John Smith"])
|
|
||||||
# #
|
|
||||||
# # # find all photos that include Alice Smith but do not contain the keyword Bar
|
|
||||||
# # photos = [p for p in photosdb.photos(persons=["Alice Smith"])
|
|
||||||
# # if p not in photosdb.photos(keywords=["Bar"]) ]
|
|
||||||
# photos = photosdb.photos()
|
|
||||||
# for p in photos:
|
|
||||||
# print(
|
|
||||||
# p.uuid(),
|
|
||||||
# p.filename(),
|
|
||||||
# p.date(),
|
|
||||||
# p.description(),
|
|
||||||
# p.name(),
|
|
||||||
# p.keywords(),
|
|
||||||
# p.albums(),
|
|
||||||
# p.persons(),
|
|
||||||
# p.path(),
|
|
||||||
# )
|
|
||||||
|
|
||||||
# if __name__ == "__main__":
|
|
||||||
# main()
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ def test_db_version():
|
|||||||
|
|
||||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS
|
||||||
|
assert photosdb.get_db_version() == "4025"
|
||||||
|
|
||||||
|
|
||||||
def test_os_version():
|
def test_os_version():
|
||||||
|
|||||||
Reference in New Issue
Block a user