Skip to content

Commit

Permalink
add test cases for expect_alt
Browse files Browse the repository at this point in the history
  • Loading branch information
saravanan30erd committed Oct 17, 2020
1 parent 699fe9e commit ad70586
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion tests/test_tolerance.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,18 @@ def test_tolerance_jsonpath_must_match_expected_value():
}
) is True

t = {
"type": "jsonpath",
"path": "$.foo[?(@.baz)].baz",
"expect": [["hello", "bonjour"]],
"expect_alt": [["hello", "joe"]]
}
ensure_hypothesis_tolerance_is_valid(t)
assert within_tolerance(
t, value={
'foo': {"baz": ["hello", "joe"]}
}
) is True

t = {
"type": "jsonpath",
Expand All @@ -152,6 +164,19 @@ def test_tolerance_jsonpath_must_match_expected_value():
}
) is True

t = {
"type": "jsonpath",
"path": "$.foo[?(@.baz)].baz",
"expect": [[["hello"], ["bonjour"]]],
"expect_alt": [[["hello"], ["joe"]]]
}
ensure_hypothesis_tolerance_is_valid(t)
assert within_tolerance(
t, value={
'foo': {"baz": [["hello"], ["joe"]]}
}
) is True

t = {
"type": "jsonpath",
"path": "$.foo[?(@.baz)].baz",
Expand Down Expand Up @@ -201,7 +226,7 @@ def test_tolerance_jsonpath_must_match_expected_values():
assert within_tolerance(
t, value={
'foo': [{"baz": "hello"}, {"baz": "bonjour"}]
},
},
) is True


Expand Down

0 comments on commit ad70586

Please sign in to comment.