Fix voluptuous breaking change things (#12611)

* Fix voluptuous breaking change things

* Change xiaomi aqara back
This commit is contained in:
Paulus Schoutsen 2018-02-22 23:29:42 -08:00 committed by GitHub
parent 6ee3c1b3e5
commit 1e672b93e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 11 deletions

View file

@ -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