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

Method test_custom_capture_miss

tests/test_validators.py:1310–1329  ·  view source on GitHub ↗

If the exception doesn't match, the underlying raise comes through

(self)

Source from the content-addressed store, hash-verified

1308 v(None, a, "d")
1309
1310 def test_custom_capture_miss(self):
1311 """
1312 If the exception doesn't match, the underlying raise comes through
1313 """
1314
1315 class MyError(Exception):
1316 """:("""
1317
1318 wrapped = in_("abc")
1319 v = not_(wrapped, exc_types=MyError)
1320 a = simple_attr("test")
1321 input_value = "d"
1322
1323 with pytest.raises(ValueError) as e:
1324 v(None, a, input_value)
1325
1326 # get the underlying exception to compare
1327 with pytest.raises(Exception) as e_from_wrapped:
1328 wrapped(None, a, input_value)
1329 assert e_from_wrapped.value.args == e.value.args
1330
1331 def test_custom_msg(self):
1332 """

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