def test_validation_if_not_strict(): tc = TypeConstraints(str) with pytest.raises(ConstraintValueError): tc.validate(1)
def test_validation_if_strict_and_nullable(): STRICT_MODE.strict_mode() tc = TypeConstraints(str, nullable=True) with pytest.raises(ConstraintValueError): tc.validate(1) STRICT_MODE._unstrict_mode()