def test_socket_timeout():
 TEST_CONF_TIMEOUT = 'timeout'
 schema = vol.Schema({vol.Required(TEST_CONF_TIMEOUT, default=None): cv.socket_timeout})
 with pytest.raises(vol.Invalid):
  schema({TEST_CONF_TIMEOUT: 0.0})
 with pytest.raises(vol.Invalid):
  schema({TEST_CONF_TIMEOUT: (-1)})
 assert (_GLOBAL_DEFAULT_TIMEOUT == schema({TEST_CONF_TIMEOUT: None})[TEST_CONF_TIMEOUT])
 assert (schema({TEST_CONF_TIMEOUT: 1})[TEST_CONF_TIMEOUT] == 1.0)

def test_socket_timeout ( ) : TEST_CONF_TIMEOUT = 'timeout' schema = vol . Schema ( { vol . Required ( TEST_CONF_TIMEOUT , default = None ) : cv . socket_timeout } ) with pytest . raises ( vol . Invalid ) : schema ( { TEST_CONF_TIMEOUT : 0.0 } ) with pytest . raises ( vol . Invalid ) : schema ( { TEST_CONF_TIMEOUT : ( - 1 ) } ) assert ( _GLOBAL_DEFAULT_TIMEOUT == schema ( { TEST_CONF_TIMEOUT : None } ) [ TEST_CONF_TIMEOUT ] ) assert ( schema ( { TEST_CONF_TIMEOUT : 1 } ) [ TEST_CONF_TIMEOUT ] == 1.0 )
test socket timeout validator .