Raises `TypeError` on wrong types.
(self, validator)
| 354 | v(None, simple_attr(class="st">"test"), None) |
| 355 | |
| 356 | def test_fail(self, validator): |
| 357 | class="st">""" |
| 358 | Raises `TypeError` on wrong types. |
| 359 | class="st">""" |
| 360 | v = optional(validator) |
| 361 | a = simple_attr(class="st">"test") |
| 362 | with pytest.raises(TypeError) as e: |
| 363 | v(None, a, class="st">"42") |
| 364 | assert ( |
| 365 | class="st">"&class="cm">#x27;test' must be <class 'int'> (got '42' that is a <class 'str'>).", |
| 366 | a, |
| 367 | int, |
| 368 | class="st">"42", |
| 369 | ) == e.value.args |
| 370 | |
| 371 | def test_repr(self, validator): |
| 372 | class="st">""" |
nothing calls this directly
no test coverage detected