def from_repr(raw_place: dict) -> Place: return Place( raw_place[Place.ID_KEY] if Place.ID_KEY in raw_place else str(uuid.uuid4()), raw_place[Place.TYPE_KEY], raw_place[Place.NAME_KEY], Coordinates.from_repr(raw_place[Place.COORDINATES_KEY]))
def test_repr(self): coordinates = Coordinates(46.0748, 11.1217) self.assertEqual(coordinates, Coordinates.from_repr(coordinates.to_repr()))