def id_place(self) -> int: if "place" not in self._raw_data: id_place = Place.find_closest_place( self.coord_lat, self.coord_lon, get_hidden=True ).id_ if id_place is not None: self.id_place = int(id_place) return int(id_place) if "@id" in self._raw_data["place"]: return int(self._raw_data["place"]["@id"]) else: return int(self._raw_data["place"]["id"])
def test_find_closest_place(self, mock_list_all): mock_list_all.return_value = ["Place"] place = Place.find_closest_place(1.1, 2.2) self.assertEqual(place, "Place")