mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 09:17:53 +00:00
Add get_age tests
This commit is contained in:
parent
16933abce9
commit
b75aa6ac08
@ -133,3 +133,8 @@ class TestDateUtil(unittest.TestCase):
|
||||
def test_parse_datetime_returns_none_for_incorrect_format(self):
|
||||
"""Test parse_datetime returns None if incorrect format."""
|
||||
self.assertIsNone(dt_util.parse_datetime("not a datetime string"))
|
||||
|
||||
def test_get_age(self):
|
||||
"""Test get_age returns 5 minutes."""
|
||||
fiveminago = dt_util.now() - timedelta(minutes=5)
|
||||
self.assertEqual(dt_util.get_age(fiveminago), "5 minutes")
|
||||
|
Loading…
x
Reference in New Issue
Block a user