Fix voluptuous breaking change things (#12611)

* Fix voluptuous breaking change things

* Change xiaomi aqara back
This commit is contained in:
Paulus Schoutsen committed 2018-02-25 11:33:54 -08:00
1 parent 9ca67c36cd
commit 7c80ef714e
3 files changed
+7 -11

No files matched your search

+5 -9
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