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

Method test_match

tests/test_validators.py:178–193  ·  view source on GitHub ↗

Silent on matches, raises ValueError on mismatches.

(self)

Source from the content-addressed store, hash-verified

176 assert matches_re.__name__ in validator_module.__all__
177
178 def test_match(self):
179 """
180 Silent on matches, raises ValueError on mismatches.
181 """
182
183 @attr.s
184 class ReTester:
185 str_match = attr.ib(validator=matches_re("a|ab"))
186
187 ReTester("ab") # shouldn't raise exceptions
188 with pytest.raises(TypeError):
189 ReTester(1)
190 with pytest.raises(ValueError):
191 ReTester("1")
192 with pytest.raises(ValueError):
193 ReTester("a1")
194
195 def test_flags(self):
196 """

Callers

nothing calls this directly

Calls 1

ReTesterClass · 0.85

Tested by

no test coverage detected