Make device tracker latitude and longitude optional (#108838)

* Make device tracker latitude and longitude optional

* Update test
pull/105569/head^2
Martin Hjelmare 2024-01-25 13:25:17 +01:00 committed by GitHub
parent 1fa7ceede3
commit 53b73bd0bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -241,12 +241,12 @@ class TrackerEntity(BaseTrackerEntity):
@property
def latitude(self) -> float | None:
"""Return latitude value of the device."""
raise NotImplementedError
return None
@property
def longitude(self) -> float | None:
"""Return longitude value of the device."""
raise NotImplementedError
return None
@property
def state(self) -> str | None:

View File

@ -506,13 +506,10 @@ def test_tracker_entity() -> None:
entity = TrackerEntity()
with pytest.raises(NotImplementedError):
assert entity.source_type is None
with pytest.raises(NotImplementedError):
assert entity.latitude is None
with pytest.raises(NotImplementedError):
assert entity.longitude is None
assert entity.latitude is None
assert entity.longitude is None
assert entity.location_name is None
with pytest.raises(NotImplementedError):
assert entity.state is None
assert entity.state is None
assert entity.battery_level is None
assert entity.should_poll is False
assert entity.force_update is True