MCPcopy
hub / github.com/python-attrs/attrs / test_validator_failure

Method test_validator_failure

tests/test_funcs.py:725–738  ·  view source on GitHub ↗

TypeError isn't swallowed when validation fails within evolve.

(self)

Source from the content-addressed store, hash-verified

723 assert e.value.args[0].endswith(expected)
724
725 def test_validator_failure(self):
726 """
727 TypeError isn't swallowed when validation fails within evolve.
728 """
729
730 @attr.s
731 class C:
732 a = attr.ib(validator=instance_of(int))
733
734 with pytest.raises(TypeError) as e:
735 evolve(C(a=1), a="some string")
736 m = e.value.args[0]
737
738 assert m.startswith("'a' must be <class 'int'>")
739
740 def test_private(self):
741 """

Callers

nothing calls this directly

Calls 2

evolveFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected