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

Method test_fail

tests/test_validators.py:1118–1131  ·  view source on GitHub ↗

Raises `TypeError` on wrong types.

(self)

Source from the content-addressed store, hash-verified

1116 v(None, simple_attr("test"), bool)
1117
1118 def test_fail(self):
1119 """
1120 Raises `TypeError` on wrong types.
1121 """
1122 v = _subclass_of(int)
1123 a = simple_attr("test")
1124 with pytest.raises(TypeError) as e:
1125 v(None, a, str)
1126 assert (
1127 "'test' must be a subclass of <class 'int'> (got <class 'str'>).",
1128 a,
1129 int,
1130 str,
1131 ) == e.value.args
1132
1133 def test_repr(self):
1134 """

Callers

nothing calls this directly

Calls 2

_subclass_ofFunction · 0.90
simple_attrFunction · 0.85

Tested by

no test coverage detected