Fix voluptuous breaking change things (#12611)
* Fix voluptuous breaking change things * Change xiaomi aqara back
This commit is contained in:
parent
6ee3c1b3e5
commit
1e672b93e7
3 changed files with 7 additions and 11 deletions
|
@ -524,18 +524,14 @@ def test_enum():
|
|||
|
||||
def test_socket_timeout(): # pylint: disable=invalid-name
|
||||
"""Test socket timeout validator."""
|
||||
TEST_CONF_TIMEOUT = 'timeout' # pylint: disable=invalid-name
|
||||
|
||||
schema = vol.Schema(
|
||||
{vol.Required(TEST_CONF_TIMEOUT, default=None): cv.socket_timeout})
|
||||
schema = vol.Schema(cv.socket_timeout)
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema({TEST_CONF_TIMEOUT: 0.0})
|
||||
schema(0.0)
|
||||
|
||||
with pytest.raises(vol.Invalid):
|
||||
schema({TEST_CONF_TIMEOUT: -1})
|
||||
schema(-1)
|
||||
|
||||
assert _GLOBAL_DEFAULT_TIMEOUT == schema({TEST_CONF_TIMEOUT:
|
||||
None})[TEST_CONF_TIMEOUT]
|
||||
assert _GLOBAL_DEFAULT_TIMEOUT == schema(None)
|
||||
|
||||
assert schema({TEST_CONF_TIMEOUT: 1})[TEST_CONF_TIMEOUT] == 1.0
|
||||
assert schema(1) == 1.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue