Skip to content

Commit

Permalink
update typeddict validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorritsandbrink committed Sep 17, 2024
1 parent 5cfc5c8 commit 54dfe14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/common/test_validation.py
Original file line number Diff line number Diff line change
@@ -334,17 +334,17 @@ def test_typeddict_friendly_exceptions() -> None:
wrong_dict["write_disposition"] = {"strategy": "scd2"}
validate_dict(EndpointResource, wrong_dict, ".")
print(e.value)
# Union of 3 types and callable
assert len(e.value.nested_exceptions) == 4
# Union of 4 types and callable
assert len(e.value.nested_exceptions) == 5

# this has wrong disposition string
with pytest.raises(DictValidationException) as e:
wrong_dict = deepcopy(valid_dict)
wrong_dict["write_disposition"] = "unknown" # type: ignore[assignment]
validate_dict(EndpointResource, wrong_dict, ".")
print(e.value)
# Union of 3 types and callable
assert len(e.value.nested_exceptions) == 4
# Union of 4 types and callable
assert len(e.value.nested_exceptions) == 5

# this has wrong nested type
with pytest.raises(DictValidationException) as e:

0 comments on commit 54dfe14

Please sign in to comment.