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

Method test_noncallable_validators

tests/test_validators.py:691–708  ·  view source on GitHub ↗

Raise `TypeError` if any validators are not callable.

(
        self, key_validator, value_validator, mapping_validator
    )

Source from the content-addressed store, hash-verified

689 ],
690 )
691 def test_noncallable_validators(
692 self, key_validator, value_validator, mapping_validator
693 ):
694 """
695 Raise `TypeError` if any validators are not callable.
696 """
697 with pytest.raises(TypeError) as e:
698 deep_mapping(key_validator, value_validator, mapping_validator)
699
700 value = 42
701 message = (
702 f"must be callable (got {value} that is a {value.__class__})."
703 )
704
705 assert message in e.value.args[0]
706 assert value == e.value.args[1]
707 assert message in e.value.msg
708 assert value == e.value.value
709
710 def test_fail_invalid_mapping(self):
711 """

Callers

nothing calls this directly

Calls 1

deep_mappingFunction · 0.90

Tested by

no test coverage detected