mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
Add script logic into helper.
This commit is contained in:
@@ -145,18 +145,19 @@ def test_icon():
|
||||
schema('mdi:work')
|
||||
|
||||
|
||||
def test_time_offset():
|
||||
"""Test time_offset validation."""
|
||||
schema = vol.Schema(cv.time_offset)
|
||||
def test_time_period():
|
||||
"""Test time_period validation."""
|
||||
schema = vol.Schema(cv.time_period)
|
||||
|
||||
for value in (
|
||||
None, '', 1234, 'hello:world', '12:', '12:34:56:78'
|
||||
None, '', 1234, 'hello:world', '12:', '12:34:56:78',
|
||||
{}, {'wrong_key': -10}
|
||||
):
|
||||
with pytest.raises(vol.MultipleInvalid):
|
||||
schema(value)
|
||||
|
||||
for value in (
|
||||
'8:20', '23:59', '-8:20', '-23:59:59', '-48:00'
|
||||
'8:20', '23:59', '-8:20', '-23:59:59', '-48:00', {'minutes': 5}
|
||||
):
|
||||
schema(value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user