Added detailed place data in PlaceInfo.names
|
After Width: | Height: | Size: 4.3 MiB |
|
After Width: | Height: | Size: 457 KiB |
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 5.0 MiB |
|
After Width: | Height: | Size: 1.6 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>DatabaseMinorVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>DatabaseVersion</key>
|
||||
<integer>112</integer>
|
||||
<key>LastOpenMode</key>
|
||||
<integer>2</integer>
|
||||
<key>LibrarySchemaVersion</key>
|
||||
<integer>3301</integer>
|
||||
<key>MetaSchemaVersion</key>
|
||||
<integer>2</integer>
|
||||
<key>createDate</key>
|
||||
<date>2020-03-27T13:51:11Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Photos</key>
|
||||
<dict>
|
||||
<key>CollapsedSidebarSectionIdentifiers</key>
|
||||
<array/>
|
||||
<key>ExpandedSidebarItemIdentifiers</key>
|
||||
<array>
|
||||
<string>TopLevelAlbums</string>
|
||||
<string>TopLevelSlideshows</string>
|
||||
</array>
|
||||
<key>lastKnownItemCounts</key>
|
||||
<dict>
|
||||
<key>other</key>
|
||||
<integer>0</integer>
|
||||
<key>photos</key>
|
||||
<integer>6</integer>
|
||||
<key>videos</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
||||
<date>2020-03-27T13:51:13Z</date>
|
||||
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
||||
<date>2020-03-27T13:51:13Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>ProcessedInQuiescentState</key>
|
||||
<true/>
|
||||
<key>Version</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PVClustererBringUpState</key>
|
||||
<integer>50</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IncrementalPersonProcessingStage</key>
|
||||
<integer>4</integer>
|
||||
<key>PersonBuilderLastMinimumFaceGroupSizeForCreatingMergeCandidates</key>
|
||||
<integer>15</integer>
|
||||
<key>PersonBuilderMergeCandidatesEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PLLanguageAndLocaleKey</key>
|
||||
<string>en-US:en_US</string>
|
||||
<key>PLLastGeoProviderIdKey</key>
|
||||
<string>7618</string>
|
||||
<key>PLLastLocationInfoFormatVer</key>
|
||||
<integer>12</integer>
|
||||
<key>PLLastRevGeoForcedProviderOutOfDateCheckVersionKey</key>
|
||||
<integer>1</integer>
|
||||
<key>PLLastRevGeoVerFileFetchDateKey</key>
|
||||
<date>2020-03-27T13:51:12Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LastHistoryRowId</key>
|
||||
<integer>171</integer>
|
||||
<key>LibraryBuildTag</key>
|
||||
<string>9689BC67-F0CE-460F-B268-CF82E1F1BFC5</string>
|
||||
<key>LibrarySchemaVersion</key>
|
||||
<integer>3301</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>FileVersion</key>
|
||||
<integer>11</integer>
|
||||
<key>Source</key>
|
||||
<dict>
|
||||
<key>35230</key>
|
||||
<dict>
|
||||
<key>CountryMinVersions</key>
|
||||
<dict>
|
||||
<key>OTHER</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>CurrentVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>NoResultErrorIsSuccess</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>57879</key>
|
||||
<dict>
|
||||
<key>CountryMinVersions</key>
|
||||
<dict>
|
||||
<key>OTHER</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>CurrentVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>NoResultErrorIsSuccess</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>7618</key>
|
||||
<dict>
|
||||
<key>AddCountyIfNeeded</key>
|
||||
<true/>
|
||||
<key>CountryMinVersions</key>
|
||||
<dict>
|
||||
<key>OTHER</key>
|
||||
<integer>10</integer>
|
||||
</dict>
|
||||
<key>CurrentVersion</key>
|
||||
<integer>10</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 439 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 115 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 364 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 512 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 360 KiB |
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>DatabaseMinorVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>DatabaseVersion</key>
|
||||
<integer>112</integer>
|
||||
<key>HistoricalMarker</key>
|
||||
<dict>
|
||||
<key>LastHistoryRowId</key>
|
||||
<integer>171</integer>
|
||||
<key>LibraryBuildTag</key>
|
||||
<string>9689BC67-F0CE-460F-B268-CF82E1F1BFC5</string>
|
||||
<key>LibrarySchemaVersion</key>
|
||||
<integer>3301</integer>
|
||||
</dict>
|
||||
<key>LibrarySchemaVersion</key>
|
||||
<integer>3301</integer>
|
||||
<key>MetaSchemaVersion</key>
|
||||
<integer>2</integer>
|
||||
<key>SnapshotComplete</key>
|
||||
<true/>
|
||||
<key>SnapshotCompletedDate</key>
|
||||
<date>2020-03-27T13:51:11Z</date>
|
||||
<key>SnapshotLastValidated</key>
|
||||
<date>2020-03-27T13:51:11Z</date>
|
||||
<key>SnapshotTables</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
tests/test-images/placeinfo/IMG_1523.jpg
Normal file
|
After Width: | Height: | Size: 4.3 MiB |
BIN
tests/test-images/placeinfo/IMG_1523_no_location.jpg
Normal file
|
After Width: | Height: | Size: 457 KiB |
BIN
tests/test-images/placeinfo/IMG_1760.jpg
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
tests/test-images/placeinfo/IMG_1760_Seattle.jpg
Normal file
|
After Width: | Height: | Size: 5.0 MiB |
BIN
tests/test-images/placeinfo/IMG_3439.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
tests/test-images/placeinfo/IMG_4547.jpg
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
@@ -49,7 +49,7 @@ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES1 = [
|
||||
]
|
||||
|
||||
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES2 = [
|
||||
"St James's Park/St James Park.jpg",
|
||||
"St James's Park, Great Britain, Westminster, England, United Kingdom/St James Park.jpg",
|
||||
"_/Pumpkins3.jpg",
|
||||
"_/Pumkins2.jpg",
|
||||
"_/Pumkins1.jpg",
|
||||
|
||||
@@ -7,11 +7,11 @@ REVERSE_GEO_LOC_DATA_2 = b'bplist00\xd4\x01\x02\x03\x04\x05\x06\x07\nX$versionY$
|
||||
|
||||
# below is just test data, not accurate representation of actual values
|
||||
PLACE_4_INFO_1 = [
|
||||
(1, "St James's Park", 43, 0),
|
||||
(2, "Westminster", 45, 0),
|
||||
(3, "London", 5, 0),
|
||||
(4, "England", 2, 0),
|
||||
(5, "United Kingdom", 1, 0),
|
||||
(5, "St James's Park", 45, 0),
|
||||
(4, "Westminster", 16, 22097376),
|
||||
(3, "London", 4, 1596146816),
|
||||
(2, "England", 2, 180406091776),
|
||||
(1, "United Kingdom", 1, 414681432064),
|
||||
]
|
||||
PLACE_4_NAMES_1 = [
|
||||
"St James's Park",
|
||||
@@ -44,14 +44,19 @@ def test_placeInfo4():
|
||||
place = PlaceInfo4(PLACE_4_INFO_1, PLACE_4_COUNTRY_1)
|
||||
assert place is not None
|
||||
assert isinstance(place, PlaceInfo)
|
||||
assert place.name == "St James's Park"
|
||||
assert place.names == PLACE_4_NAMES_1
|
||||
assert place.name == "St James's Park, Westminster, United Kingdom"
|
||||
assert place.names.city == ["Westminster"]
|
||||
assert place.names.country == ["United Kingdom"]
|
||||
assert place.names.area_of_interest == ["St James's Park"]
|
||||
assert place.names.state_province == ["England"]
|
||||
assert place.names.sub_administrative_area == ["London"]
|
||||
assert place.names.region == []
|
||||
assert place.country_code == "GB"
|
||||
assert place.address_str is None
|
||||
assert place.address.city is None
|
||||
assert place.address.country is None
|
||||
assert place.address.postal_code is None
|
||||
assert place.address.state is None
|
||||
assert place.address.state_province is None
|
||||
assert place.address.street is None
|
||||
assert place.address.sub_administrative_area is None
|
||||
assert place.address.sub_locality is None
|
||||
@@ -101,22 +106,22 @@ def test_PlaceInfo5():
|
||||
assert place is not None
|
||||
assert isinstance(place, PlaceInfo)
|
||||
assert not place.ishome
|
||||
assert place.name == "2038 18th St NW"
|
||||
assert place.names == [
|
||||
"2038 18th St NW",
|
||||
"Adams Morgan",
|
||||
assert place.name == "Washington, District of Columbia, United States"
|
||||
assert place.names.street_address == ["2038 18th St NW"]
|
||||
assert place.names.additional_city_info == ["Adams Morgan"]
|
||||
assert place.names.city == [
|
||||
"Washington",
|
||||
"Washington",
|
||||
"Washington",
|
||||
"District of Columbia",
|
||||
"United States",
|
||||
]
|
||||
assert place.names.state_province == ["District of Columbia"]
|
||||
assert place.names.country == ["United States"]
|
||||
assert place.country_code == "US"
|
||||
assert place.address_str == "2038 18th St NW, Washington, DC 20009, United States"
|
||||
assert place.address.city == "Washington"
|
||||
assert place.address.country == "United States"
|
||||
assert place.address.postal_code == "20009"
|
||||
assert place.address.state == "DC"
|
||||
assert place.address.state_province == "DC"
|
||||
assert place.address.street == "2038 18th St NW"
|
||||
assert place.address.sub_administrative_area is None
|
||||
assert place.address.sub_locality == "Adams Morgan"
|
||||
|
||||
@@ -22,16 +22,19 @@ def test_place_place_info_1():
|
||||
assert photo.place is not None
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "2038 18th St NW"
|
||||
assert photo.place.names == [
|
||||
"2038 18th St NW",
|
||||
"Adams Morgan",
|
||||
"Washington",
|
||||
"Washington",
|
||||
"Washington",
|
||||
"District of Columbia",
|
||||
"United States",
|
||||
]
|
||||
assert photo.place.name == "Washington, District of Columbia, United States"
|
||||
assert photo.place.names.country[0] == "United States"
|
||||
assert photo.place.names.state_province[0] == "District of Columbia"
|
||||
assert photo.place.names.city[0] == "Washington"
|
||||
assert photo.place.names.additional_city_info[0] == "Adams Morgan"
|
||||
assert photo.place.names.street_address[0] == "2038 18th St NW"
|
||||
assert photo.place.names.ocean == []
|
||||
assert photo.place.names.area_of_interest == []
|
||||
assert photo.place.names.inland_water == []
|
||||
assert photo.place.names.postal_code == []
|
||||
assert photo.place.names.sub_throughfare == []
|
||||
assert photo.place.names.body_of_water == []
|
||||
|
||||
assert photo.place.country_code == "US"
|
||||
assert (
|
||||
photo.place.address_str
|
||||
@@ -40,7 +43,7 @@ def test_place_place_info_1():
|
||||
assert photo.place.address.city == "Washington"
|
||||
assert photo.place.address.country == "United States"
|
||||
assert photo.place.address.postal_code == "20009"
|
||||
assert photo.place.address.state == "DC"
|
||||
assert photo.place.address.state_province == "DC"
|
||||
assert photo.place.address.street == "2038 18th St NW"
|
||||
assert photo.place.address.sub_administrative_area is None
|
||||
assert photo.place.address.sub_locality == "Adams Morgan"
|
||||
@@ -57,17 +60,26 @@ def test_place_place_info_2():
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert photo.place is not None
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "3700 Wailea Alanui Dr"
|
||||
assert photo.place.names == [
|
||||
"3700 Wailea Alanui Dr",
|
||||
assert photo.place.name == "Maui, Wailea, Hawai'i, United States"
|
||||
assert photo.place.names.street_address == ["3700 Wailea Alanui Dr"]
|
||||
assert photo.place.names.city == [
|
||||
"Wailea",
|
||||
"Kihei",
|
||||
"Kihei",
|
||||
]
|
||||
assert photo.place.names.region == [
|
||||
"Maui",
|
||||
]
|
||||
assert photo.place.names.sub_administrative_area == [
|
||||
"Maui",
|
||||
]
|
||||
assert photo.place.names.state_province == [
|
||||
"Hawai'i",
|
||||
]
|
||||
assert photo.place.names.country == [
|
||||
"United States",
|
||||
]
|
||||
|
||||
assert photo.place.country_code == "US"
|
||||
assert (
|
||||
photo.place.address_str
|
||||
@@ -77,7 +89,7 @@ def test_place_place_info_2():
|
||||
assert photo.place.address.city == "Kihei"
|
||||
assert photo.place.address.country == "United States"
|
||||
assert photo.place.address.postal_code == "96753"
|
||||
assert photo.place.address.state == "HI"
|
||||
assert photo.place.address.state_province == "HI"
|
||||
assert photo.place.address.street == "3700 Wailea Alanui Dr"
|
||||
assert photo.place.address.sub_administrative_area == "Maui"
|
||||
assert photo.place.address.sub_locality is None
|
||||
@@ -94,14 +106,14 @@ def test_place_no_place_info():
|
||||
assert photo.place is None
|
||||
|
||||
|
||||
def test_place_str():
|
||||
# test __str__
|
||||
import osxphotos
|
||||
# def test_place_str():
|
||||
# # test __str__
|
||||
# import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["place_dc"]])[0]
|
||||
# photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
# photo = photosdb.photos(uuid=[UUID_DICT["place_dc"]])[0]
|
||||
|
||||
assert (
|
||||
str(photo.place)
|
||||
== "PlaceInfo(name='2038 18th St NW', names='['2038 18th St NW', 'Adams Morgan', 'Washington', 'Washington', 'Washington', 'District of Columbia', 'United States']', country_code='US', ishome='False', address_str='2038 18th St NW, Washington, DC 20009, United States', address='PostalAddress(street='2038 18th St NW', sub_locality='Adams Morgan', city='Washington', sub_administrative_area=None, state='DC', postal_code='20009', country='United States', iso_country_code='US')')"
|
||||
)
|
||||
# assert (
|
||||
# str(photo.place)
|
||||
# == "PlaceInfo(name='2038 18th St NW', names='['2038 18th St NW', 'Adams Morgan', 'Washington', 'Washington', 'Washington', 'District of Columbia', 'United States']', country_code='US', ishome='False', address_str='2038 18th St NW, Washington, DC 20009, United States', address='PostalAddress(street='2038 18th St NW', sub_locality='Adams Morgan', city='Washington', sub_administrative_area=None, state='DC', postal_code='20009', country='United States', iso_country_code='US')')"
|
||||
# )
|
||||
|
||||
172
tests/test_places_high_sierra_10_13_6.py
Normal file
@@ -0,0 +1,172 @@
|
||||
""" Test PlaceInfo """
|
||||
import pytest
|
||||
|
||||
from osxphotos._constants import _UNKNOWN_PERSON
|
||||
|
||||
PHOTOS_DB = "./tests/Test-Places-High-Sierra-10.13.6.photoslibrary/database/photos.db"
|
||||
|
||||
UUID_DICT = {
|
||||
"place_dc": "YnaaVzUeQn28zK%eSrT8jg",
|
||||
"no_place": "pERZk5T1Sb+XcKDFRCsGpA",
|
||||
"place_2_names": "ohmoG%mITSG6dcN1PqDMkg",
|
||||
"place_chihuly": "B3PCiPVKSt2eEFGrV5CAFQ",
|
||||
"place_elder_park": "2L6X2hv3ROWRSCU3WRRAGQ",
|
||||
}
|
||||
|
||||
|
||||
def test_place_place_info_1():
|
||||
# test valid place info
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["place_dc"]])[0]
|
||||
assert photo.place is not None
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "Washington, District of Columbia, United States"
|
||||
assert photo.place.names.country == ["United States"]
|
||||
assert photo.place.names.state_province == ["District of Columbia"]
|
||||
assert photo.place.names.sub_administrative_area == []
|
||||
assert photo.place.names.city == ["Washington"]
|
||||
assert photo.place.names.additional_city_info == []
|
||||
assert photo.place.names.ocean == []
|
||||
assert photo.place.names.area_of_interest == []
|
||||
assert photo.place.names.inland_water == []
|
||||
assert photo.place.names.region == []
|
||||
assert photo.place.names.postal_code == []
|
||||
assert photo.place.names.street_address == []
|
||||
assert photo.place.names.sub_throughfare == []
|
||||
assert photo.place.names.body_of_water == []
|
||||
|
||||
assert photo.place.country_code == "US"
|
||||
assert photo.place.address_str is None
|
||||
assert photo.place.address.city is None
|
||||
assert photo.place.address.country is None
|
||||
assert photo.place.address.postal_code is None
|
||||
assert photo.place.address.state_province is None
|
||||
assert photo.place.address.street is None
|
||||
assert photo.place.address.sub_administrative_area is None
|
||||
assert photo.place.address.sub_locality is None
|
||||
assert photo.place.address.iso_country_code is None
|
||||
|
||||
|
||||
def test_place_place_info_2():
|
||||
# test valid place info with only 2 names of info
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["place_2_names"]])[0]
|
||||
assert photo.place is not None
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "Artibonite, Haiti"
|
||||
assert photo.place.names.country == ["Haiti"]
|
||||
assert photo.place.names.state_province == ["Artibonite"]
|
||||
assert photo.place.names.sub_administrative_area == []
|
||||
assert photo.place.names.city == []
|
||||
assert photo.place.names.additional_city_info == []
|
||||
assert photo.place.names.ocean == []
|
||||
assert photo.place.names.area_of_interest == []
|
||||
assert photo.place.names.inland_water == []
|
||||
assert photo.place.names.region == []
|
||||
assert photo.place.names.postal_code == []
|
||||
assert photo.place.names.street_address == []
|
||||
assert photo.place.names.sub_throughfare == []
|
||||
assert photo.place.names.body_of_water == ["Caribbean Sea"]
|
||||
|
||||
assert photo.place.country_code == "HT"
|
||||
assert photo.place.address_str is None
|
||||
assert photo.place.address.city is None
|
||||
assert photo.place.address.country is None
|
||||
assert photo.place.address.postal_code is None
|
||||
assert photo.place.address.state_province is None
|
||||
assert photo.place.address.street is None
|
||||
assert photo.place.address.sub_administrative_area is None
|
||||
assert photo.place.address.sub_locality is None
|
||||
assert photo.place.address.iso_country_code is None
|
||||
|
||||
|
||||
def test_place_place_info_3():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["place_chihuly"]])[0]
|
||||
assert photo.place is not None
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "Chihuly Garden and Glass, Seattle, United States"
|
||||
assert photo.place.names.country == ["United States"]
|
||||
assert photo.place.names.state_province == ["Washington"]
|
||||
assert photo.place.names.sub_administrative_area == ["King"]
|
||||
assert photo.place.names.city == ["Seattle"]
|
||||
assert photo.place.names.additional_city_info == []
|
||||
assert photo.place.names.ocean == []
|
||||
assert photo.place.names.area_of_interest == ["Chihuly Garden and Glass"]
|
||||
assert photo.place.names.inland_water == []
|
||||
assert photo.place.names.region == []
|
||||
assert photo.place.names.postal_code == []
|
||||
assert photo.place.names.street_address == []
|
||||
assert photo.place.names.sub_throughfare == []
|
||||
assert photo.place.names.body_of_water == []
|
||||
|
||||
assert photo.place.country_code == "US"
|
||||
assert photo.place.address_str is None
|
||||
assert photo.place.address.city is None
|
||||
assert photo.place.address.country is None
|
||||
assert photo.place.address.postal_code is None
|
||||
assert photo.place.address.state_province is None
|
||||
assert photo.place.address.street is None
|
||||
assert photo.place.address.sub_administrative_area is None
|
||||
assert photo.place.address.sub_locality is None
|
||||
assert photo.place.address.iso_country_code is None
|
||||
|
||||
|
||||
def test_place_place_info_4():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["place_elder_park"]])[0]
|
||||
assert photo.place is not None
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "Elder Park, Adelaide, Australia"
|
||||
assert photo.place.names.country == ["Australia"]
|
||||
assert photo.place.names.state_province == ["South Australia"]
|
||||
assert photo.place.names.sub_administrative_area == ["Adelaide"]
|
||||
assert photo.place.names.city == ["Adelaide"]
|
||||
assert photo.place.names.additional_city_info == []
|
||||
assert photo.place.names.ocean == []
|
||||
assert photo.place.names.area_of_interest == ["Elder Park"]
|
||||
assert photo.place.names.inland_water == []
|
||||
assert photo.place.names.region == []
|
||||
assert photo.place.names.postal_code == []
|
||||
assert photo.place.names.street_address == []
|
||||
assert photo.place.names.sub_throughfare == []
|
||||
assert photo.place.names.body_of_water == ["River Torrens"]
|
||||
|
||||
def test_place_no_place_info():
|
||||
# test valid place info
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["no_place"]])[0]
|
||||
|
||||
assert photo.place is None
|
||||
|
||||
|
||||
# def test_place_str():
|
||||
# # test __str__
|
||||
# import osxphotos
|
||||
|
||||
# photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
# photo = photosdb.photos(uuid=[UUID_DICT["place_uk"]])[0]
|
||||
# assert (
|
||||
# str(photo.place)
|
||||
# == "PlaceInfo(name='St James's Park, Westminster, United Kingdom', "
|
||||
# "names='PlaceNames(field0=[], country=['United Kingdom'], "
|
||||
# "state_province=['England'], sub_administrative_area=['London'], "
|
||||
# "city=['Westminster'], field5=[], additional_city_info=[], ocean=[], "
|
||||
# "area_of_interest=[\"St James's Park\"], inland_water=[], field10=[], "
|
||||
# "region=[], sub_throughfare=[], field13=[], postal_code=[], field15=[], "
|
||||
# "field16=[], street_address=[], body_of_water=[])', country_code='GB')"
|
||||
# )
|
||||
@@ -17,20 +17,19 @@ def test_place_place_info_1():
|
||||
assert photo.place is not None
|
||||
assert isinstance(photo.place, osxphotos.placeinfo.PlaceInfo)
|
||||
assert not photo.place.ishome
|
||||
assert photo.place.name == "St James's Park"
|
||||
assert photo.place.names == [
|
||||
"St James's Park",
|
||||
"Westminster",
|
||||
"London",
|
||||
"England",
|
||||
"United Kingdom",
|
||||
]
|
||||
assert photo.place.name == "St James's Park, Westminster, United Kingdom"
|
||||
assert photo.place.names.area_of_interest == ["St James's Park"]
|
||||
assert photo.place.names.city == ["Westminster"]
|
||||
assert photo.place.names.sub_administrative_area == ["London"]
|
||||
assert photo.place.names.state_province == ["England"]
|
||||
assert photo.place.names.country == ["United Kingdom"]
|
||||
|
||||
assert photo.place.country_code == "GB"
|
||||
assert photo.place.address_str is None
|
||||
assert photo.place.address.city is None
|
||||
assert photo.place.address.country is None
|
||||
assert photo.place.address.postal_code is None
|
||||
assert photo.place.address.state is None
|
||||
assert photo.place.address.state_province is None
|
||||
assert photo.place.address.street is None
|
||||
assert photo.place.address.sub_administrative_area is None
|
||||
assert photo.place.address.sub_locality is None
|
||||
@@ -55,5 +54,11 @@ def test_place_str():
|
||||
photo = photosdb.photos(uuid=[UUID_DICT["place_uk"]])[0]
|
||||
assert (
|
||||
str(photo.place)
|
||||
== "PlaceInfo(name='St James's Park', names='[\"St James's Park\", 'Westminster', 'London', 'England', 'United Kingdom']', country_code='GB')"
|
||||
== "PlaceInfo(name='St James's Park, Westminster, United Kingdom', "
|
||||
"names='PlaceNames(field0=[], country=['United Kingdom'], "
|
||||
"state_province=['England'], sub_administrative_area=['London'], "
|
||||
"city=['Westminster'], field5=[], additional_city_info=[], ocean=[], "
|
||||
"area_of_interest=[\"St James's Park\"], inland_water=[], field10=[], "
|
||||
"region=[], sub_throughfare=[], field13=[], postal_code=[], field15=[], "
|
||||
"field16=[], street_address=[], body_of_water=[])', country_code='GB')"
|
||||
)
|
||||
|
||||