mirror of
https://github.com/home-assistant/core
synced 2024-08-06 09:34:49 +02: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):
|
def test_parse_datetime_returns_none_for_incorrect_format(self):
|
||||||
"""Test parse_datetime returns None if incorrect format."""
|
"""Test parse_datetime returns None if incorrect format."""
|
||||||
self.assertIsNone(dt_util.parse_datetime("not a datetime string"))
|
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…
Reference in New Issue
Block a user