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

Method test_fails_because_success

tests/test_validators.py:1180–1203  ·  view source on GitHub ↗

If the wrapped validator doesn't fail, not_ should fail.

(self)

Source from the content-addressed store, hash-verified

1178 v(1, a, input_value)
1179
1180 def test_fails_because_success(self):
1181 """
1182 If the wrapped validator doesn't fail, not_ should fail.
1183 """
1184
1185 def always_passes(inst, attr, value):
1186 pass
1187
1188 v = not_(always_passes)
1189 a = simple_attr("test")
1190 input_value = 3
1191
1192 with pytest.raises(ValueError) as e:
1193 v(1, a, input_value)
1194
1195 assert (
1196 (
1197 f"not_ validator child '{always_passes!r}' did not raise a captured error"
1198 ),
1199 a,
1200 always_passes,
1201 input_value,
1202 self.DEFAULT_EXC_TYPES,
1203 ) == e.value.args
1204
1205 def test_composable_with_in_pass(self):
1206 """

Callers

nothing calls this directly

Calls 2

not_Function · 0.90
simple_attrFunction · 0.85

Tested by

no test coverage detected