Skip to content

Commit 6f13a89

Browse files
Improve test assertion to verify pydantic validation details are injected
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/c1bb2774-9802-4976-9c81-851b72ce5735 Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
1 parent 675e82a commit 6f13a89

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/usethis/_file/test_validate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def test_custom_error_msg_preserved(self):
4646
def test_validation_details_injected(self):
4747
with pytest.raises(_CustomError, match="validation error") as exc_info:
4848
validate_or_raise(str, 123, err=_CustomError("bad type"))
49-
assert "bad type" in str(exc_info.value)
49+
msg = str(exc_info.value)
50+
assert "bad type" in msg
51+
assert "Input should be a valid string" in msg
5052

5153
def test_coercion(self):
5254
result = validate_or_raise(float, 1, err=_CustomError("fail"))

0 commit comments

Comments
 (0)