mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Fix flaky template test (#6768)
This commit is contained in:
parent
5dfdb9e481
commit
efbd66bca1
@ -151,13 +151,14 @@ class TestHelpersTemplate(unittest.TestCase):
|
||||
|
||||
def test_timestamp_custom(self):
|
||||
"""Test the timestamps to custom filter."""
|
||||
now = dt_util.utcnow()
|
||||
tests = [
|
||||
(None, None, None, 'None'),
|
||||
(1469119144, None, True, '2016-07-21 16:39:04'),
|
||||
(1469119144, '%Y', True, '2016'),
|
||||
(1469119144, 'invalid', True, 'invalid'),
|
||||
(dt_util.as_timestamp(dt_util.utcnow()), None, False,
|
||||
dt_util.now().strftime('%Y-%m-%d %H:%M:%S'))
|
||||
(dt_util.as_timestamp(now), None, False,
|
||||
now.strftime('%Y-%m-%d %H:%M:%S'))
|
||||
]
|
||||
|
||||
for inp, fmt, local, out in tests:
|
||||
@ -202,11 +203,12 @@ class TestHelpersTemplate(unittest.TestCase):
|
||||
|
||||
def test_timestamp_utc(self):
|
||||
"""Test the timestamps to local filter."""
|
||||
now = dt_util.utcnow()
|
||||
tests = {
|
||||
None: 'None',
|
||||
1469119144: '2016-07-21 16:39:04',
|
||||
dt_util.as_timestamp(dt_util.utcnow()):
|
||||
dt_util.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
dt_util.as_timestamp(now):
|
||||
now.strftime('%Y-%m-%d %H:%M:%S')
|
||||
}
|
||||
|
||||
for inp, out in tests.items():
|
||||
|
Loading…
x
Reference in New Issue
Block a user