Add 100% test coverage to Madvr (#122350)

* feat: add 100% test coverage

* fix: dont patch logger

* fix: better names

* fix: use consts

* fix: use built in const
This commit is contained in:
ilan 2024-07-23 12:06:26 -04:00 committed by GitHub
parent 3ba2a0518e
commit 0a62a4459f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 87 additions and 5 deletions

View file

@ -58,7 +58,7 @@ def get_temperature(coordinator: MadVRCoordinator, key: str) -> float | None:
"""Get temperature value if valid, otherwise return None."""
try:
temp = float(coordinator.data.get(key, 0))
except ValueError:
except (AttributeError, ValueError):
return None
else:
return temp if is_valid_temperature(temp) else None