How to use the osxphotos.placeinfo.PlaceInfo5 function in osxphotos

To help you get started, we’ve selected a few osxphotos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PlaceInfo5_eq():
    # test __eq__
    from osxphotos.placeinfo import PlaceInfo5

    place1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    place2 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    assert place1 == place2
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PlaceInfo5_ne():
    # test __ne__
    from osxphotos.placeinfo import PlaceInfo5

    place1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    place2 = PlaceInfo5(REVERSE_GEO_LOC_DATA_2)
    assert place1 != place2
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PLRevGeoLocationInfo_2():
    # test PLRevGeoLocationInfo class archive/unarchive
    from bpylist import archiver
    from osxphotos.placeinfo import (
        PlaceInfo,
        PlaceInfo5,
        PLRevGeoLocationInfo,
        CNPostalAddress,
        PLRevGeoMapItem,
        PLRevGeoMapItemAdditionalPlaceInfo,
    )

    place_1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    plrevgeoloc_1 = place_1._plrevgeoloc
    archived = archiver.archive(plrevgeoloc_1)
    place_1_unarchived = PlaceInfo5(archived)
    assert isinstance(place_1_unarchived, PlaceInfo)
    assert place_1_unarchived._plrevgeoloc == place_1._plrevgeoloc
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PLRevGeoLocationInfo_1():
    # test PLRevGeoLocationInfo class
    from osxphotos.placeinfo import (
        PlaceInfo,
        PlaceInfo5,
        PLRevGeoLocationInfo,
        CNPostalAddress,
        PLRevGeoMapItem,
        PLRevGeoMapItemAdditionalPlaceInfo,
    )

    place_1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    plrevgeoloc_1 = place_1._plrevgeoloc
    assert type(plrevgeoloc_1) == PLRevGeoLocationInfo
    assert type(plrevgeoloc_1.postalAddress) == CNPostalAddress
    assert type(plrevgeoloc_1.mapItem) == PLRevGeoMapItem
    assert (
        type(plrevgeoloc_1.mapItem.sortedPlaceInfos[0])
        == PLRevGeoMapItemAdditionalPlaceInfo
    )

    assert (
        plrevgeoloc_1.addressString
        == "2038 18th St NW, Washington, DC  20009, United States"
    )
    assert plrevgeoloc_1.countryCode == "US"
    assert plrevgeoloc_1.version == 13
    assert plrevgeoloc_1.isHome is False
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PLRevGeoLocationInfo_2():
    # test PLRevGeoLocationInfo class archive/unarchive
    from bpylist import archiver
    from osxphotos.placeinfo import (
        PlaceInfo,
        PlaceInfo5,
        PLRevGeoLocationInfo,
        CNPostalAddress,
        PLRevGeoMapItem,
        PLRevGeoMapItemAdditionalPlaceInfo,
    )

    place_1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    plrevgeoloc_1 = place_1._plrevgeoloc
    archived = archiver.archive(plrevgeoloc_1)
    place_1_unarchived = PlaceInfo5(archived)
    assert isinstance(place_1_unarchived, PlaceInfo)
    assert place_1_unarchived._plrevgeoloc == place_1._plrevgeoloc
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_placeInfo4_ne3():
    # test __ne__ unlike objects
    from osxphotos.placeinfo import PlaceInfo4, PlaceInfo5

    place1 = PlaceInfo4(PLACE_4_INFO_2, PLACE_4_COUNTRY_2)
    place2 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    assert place1 != place2
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PlaceInfo5_eq():
    # test __eq__
    from osxphotos.placeinfo import PlaceInfo5

    place1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    place2 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    assert place1 == place2
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PlaceInfo5():
    # test valid place data info returns a PlaceInfo object
    from osxphotos.placeinfo import PlaceInfo5, PlaceInfo

    place = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    assert place is not None
    assert isinstance(place, PlaceInfo)
    assert not place.ishome
    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"]
    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_province == "DC"
    assert place.address.street == "2038 18th St NW"
github RhetTbull / osxphotos / tests / test_placeinfo.py View on Github external
def test_PlaceInfo5_ne2():
    # test __ne__ unlike objects
    from osxphotos.placeinfo import PlaceInfo5, PlaceInfo4

    place1 = PlaceInfo5(REVERSE_GEO_LOC_DATA_1)
    place2 = "Foo"
    assert place1 != place2
github RhetTbull / osxphotos / osxphotos / photoinfo / photoinfo.py View on Github external
try:
                return self._place  # pylint: disable=access-member-before-definition
            except AttributeError:
                if self._info["placeNames"]:
                    self._place = PlaceInfo4(
                        self._info["placeNames"], self._info["countryCode"]
                    )
                else:
                    self._place = None
                return self._place
        else:
            try:
                return self._place  # pylint: disable=access-member-before-definition
            except AttributeError:
                if self._info["reverse_geolocation"]:
                    self._place = PlaceInfo5(self._info["reverse_geolocation"])
                else:
                    self._place = None
                return self._place