def test_boolean_basic_validation(): b = types.BooleanType() b.validate(True) b.validate(False) with pytest.raises(exceptions.ValidationException): b.validate(types.Unset)
def test_boolean_strict_validation(): b = types.BooleanType(strict=True) b.validate(True) b.validate(False) with pytest.raises(exceptions.ValidationException): b.validate('true') with pytest.raises(exceptions.ValidationException): b.validate('false')
def test_boolean_string_validation(): b = types.BooleanType() b.validate('true') b.validate('false')
def test_boolean_instance_config_default(): b = types.BooleanType(default=True) assert b.to_native(types.Unset) == True assert b.to_native(False) == False
class TestType(types.Type): s = types.StringType() b = types.BooleanType()
class TestType(types.Type): st = types.SumType(types.StringType(min_length=10), types.BooleanType()) b = types.BooleanType()