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

Method test_custom_msg

tests/test_validators.py:1331–1350  ·  view source on GitHub ↗

If provided, use the custom message in the raised error

(self)

Source from the content-addressed store, hash-verified

1329 assert e_from_wrapped.value.args == e.value.args
1330
1331 def test_custom_msg(self):
1332 """
1333 If provided, use the custom message in the raised error
1334 """
1335 custom_msg = "custom message!"
1336 wrapped = in_("abc")
1337 v = not_(wrapped, msg=custom_msg)
1338 a = simple_attr("test")
1339 input_value = "a"
1340
1341 with pytest.raises(ValueError) as e:
1342 v(None, a, input_value)
1343
1344 assert (
1345 custom_msg,
1346 a,
1347 wrapped,
1348 input_value,
1349 self.DEFAULT_EXC_TYPES,
1350 ) == e.value.args
1351
1352 def test_bad_exception_args(self):
1353 """

Callers

nothing calls this directly

Calls 3

in_Function · 0.90
not_Function · 0.90
simple_attrFunction · 0.85

Tested by

no test coverage detected