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

Method test_fail

tests/test_validators.py:830–846  ·  view source on GitHub ↗

Raise TypeError if the value is not callable.

(self)

Source from the content-addressed store, hash-verified

828 v(None, a, isinstance)
829
830 def test_fail(self):
831 """
832 Raise TypeError if the value is not callable.
833 """
834 v = is_callable()
835 a = simple_attr("test")
836 with pytest.raises(TypeError) as e:
837 v(None, a, None)
838
839 value = None
840 message = "'test' must be callable (got {value} that is a {type_})."
841 expected_message = message.format(value=value, type_=value.__class__)
842
843 assert expected_message == e.value.args[0]
844 assert value == e.value.args[1]
845 assert expected_message == e.value.msg
846 assert value == e.value.value
847
848 def test_repr(self):
849 """

Callers

nothing calls this directly

Calls 2

is_callableFunction · 0.90
simple_attrFunction · 0.85

Tested by

no test coverage detected