def test_enforce_strict_mode(): strict_mode() @typed @dataclasses.dataclass class Foo: bar: str with pytest.raises(ConstraintValueError): Foo(1) resolver.STRICT._unstrict_mode()
def test_constrained_any(): strict_mode() @typed @dataclasses.dataclass class Foo: bar: typing.Any assert Foo(1).bar == 1 assert Foo("bar").bar == "bar" resolver.STRICT._unstrict_mode()
def test_strict_mode(): assert not is_strict_mode() strict_mode() assert is_strict_mode() resolver.STRICT._unstrict_mode() assert not is_strict_mode()