Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/wire/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def python_accepts(value: Any) -> bool:
return True


@example({"table": "t", "start": {"row": {}, "exclusive": 1}}) # a draw seldom puts a non-boolean there
@given(corrupted(asts(static=True)))
def test_accepts_what_upstream_accepts(harness: Harness, value: Any) -> None:
assert python_accepts(value) == harness.call("accepts", schema="ast", value=value)
Expand Down
13 changes: 13 additions & 0 deletions tests/wire/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def _crud(*ops: Any) -> dict[str, Any]:
("cleanupResultsArg", {"clientGroupID": "g", "clientID": "c", "upToMutationID": 1, "b": 1, "a": 2, "0": 3}),
("cleanupResultsArg", {"clientGroupID": "g", "clientID": "c", "upToMutationID": "1"}),
("cleanupResultsArg", "x"),
("cleanupResultsArg", True),
("mutateParams", {"schema": 1, "appID": 2}),
]

Expand All @@ -123,3 +124,15 @@ def _crud(*ops: Any) -> dict[str, Any]:
def test_pinned_refusals_match_upstream(harness: Harness, schema: str, value: Any) -> None:
type_, mode = VALITA[schema]
assert valita.parse_error(value, type_, mode) == harness.call("refusal", schema=schema, value=value)


# Draws the random acceptance test seldom makes: query args that are not a list.
PINNED_VALUES: list[tuple[str, Any]] = [
("transformRequest", ["transform", [{"id": "1", "name": "n", "args": "x"}]]),
]


@pytest.mark.parametrize(("schema", "value"), PINNED_VALUES)
def test_pinned_values_match_upstream(harness: Harness, schema: str, value: Any) -> None:
_strategy, parse = CASES[schema]
assert accepts(parse, value) == harness.call("accepts", schema=schema, value=value)
Loading
Loading