Changed PhotosDB albums interface as prep for adding folders
This commit is contained in:
@@ -72,13 +72,13 @@ def test_keywords():
|
||||
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
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.album_names
|
||||
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.album_names)
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
|
||||
@@ -150,13 +150,13 @@ def test_keywords():
|
||||
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
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.album_names
|
||||
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.album_names)
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
|
||||
@@ -150,13 +150,13 @@ def test_keywords():
|
||||
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
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.album_names
|
||||
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.album_names)
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
@@ -366,7 +366,7 @@ def test_count():
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = photosdb.photos()
|
||||
assert len(photos) == 8
|
||||
assert len(photos) == 8
|
||||
|
||||
|
||||
def test_keyword_2():
|
||||
@@ -772,7 +772,7 @@ def test_from_to_date():
|
||||
assert len(photos) == 2
|
||||
|
||||
photos = photosdb.photos(to_date=dt.datetime(2018, 10, 28))
|
||||
assert len(photos) == 6
|
||||
assert len(photos) == 6
|
||||
|
||||
photos = photosdb.photos(
|
||||
from_date=dt.datetime(2018, 9, 28), to_date=dt.datetime(2018, 9, 29)
|
||||
|
||||
@@ -52,12 +52,12 @@ def test_keywords():
|
||||
assert photosdb.keywords == []
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
import collections
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
assert photosdb.albums == []
|
||||
assert photosdb.album_names == []
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
|
||||
@@ -71,13 +71,13 @@ def test_keywords():
|
||||
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
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.album_names
|
||||
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.album_names)
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
|
||||
@@ -71,13 +71,13 @@ def test_keywords():
|
||||
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
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.album_names
|
||||
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.album_names)
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
|
||||
@@ -76,13 +76,13 @@ def test_keywords():
|
||||
assert collections.Counter(KEYWORDS) == collections.Counter(photosdb.keywords)
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
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.album_names
|
||||
assert collections.Counter(ALBUMS) == collections.Counter(photosdb.album_names)
|
||||
|
||||
|
||||
def test_keywords_dict():
|
||||
|
||||
@@ -26,11 +26,11 @@ UUID_SHARED = [
|
||||
UUID_NOT_SHARED = ["37210110-E940-4227-92D3-45C40F68EB0A"]
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
albums = photosdb.albums
|
||||
albums = photosdb.album_names
|
||||
|
||||
assert len(albums) == 1
|
||||
assert albums[0] == ALBUMS[0]
|
||||
@@ -40,7 +40,7 @@ def test_albums_shared():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
albums_shared = photosdb.albums_shared
|
||||
albums_shared = photosdb.album_names_shared
|
||||
|
||||
assert len(albums_shared) == 1
|
||||
assert albums_shared[0] == ALBUMS_SHARED[0]
|
||||
|
||||
@@ -11,22 +11,22 @@ ALBUMS = ["Pumpkin Farm", "Test Album", "Test Album (1)"]
|
||||
ALBUM_DICT = {"Pumpkin Farm": 3, "Test Album": 1, "Test Album (1)": 1}
|
||||
|
||||
|
||||
def test_albums():
|
||||
def test_album_names():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
albums = photosdb.albums
|
||||
albums = photosdb.album_names
|
||||
|
||||
assert len(albums) == len(ALBUMS)
|
||||
for album in albums:
|
||||
assert album in ALBUMS
|
||||
|
||||
|
||||
def test_albums_shared():
|
||||
def test_albums_names_shared():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
albums_shared = photosdb.albums_shared
|
||||
albums_shared = photosdb.album_names_shared
|
||||
|
||||
assert len(albums_shared) == 0
|
||||
|
||||
@@ -65,4 +65,3 @@ def test_not_shared():
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = [p for p in photosdb.photos() if not p.shared]
|
||||
assert len(photos) == 7
|
||||
|
||||
|
||||
Reference in New Issue
Block a user