Skip to content

Commit 2e4ef91

Browse files
add test cases for expect_alt
Signed-off-by: saravanan palanisamy <saravanan30erd@gmail.com>
1 parent 300500d commit 2e4ef91

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

tests/test_tolerance.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,18 @@ def test_tolerance_jsonpath_must_match_expected_value():
139139
}
140140
) is True
141141

142+
t = {
143+
"type": "jsonpath",
144+
"path": "$.foo[?(@.baz)].baz",
145+
"expect": [["hello", "bonjour"]],
146+
"expect_alt": [["hello", "joe"]]
147+
}
148+
ensure_hypothesis_tolerance_is_valid(t)
149+
assert within_tolerance(
150+
t, value={
151+
'foo': {"baz": ["hello", "joe"]}
152+
}
153+
) is True
142154

143155
t = {
144156
"type": "jsonpath",
@@ -152,6 +164,19 @@ def test_tolerance_jsonpath_must_match_expected_value():
152164
}
153165
) is True
154166

167+
t = {
168+
"type": "jsonpath",
169+
"path": "$.foo[?(@.baz)].baz",
170+
"expect": [[["hello"], ["bonjour"]]],
171+
"expect_alt": [[["hello"], ["joe"]]]
172+
}
173+
ensure_hypothesis_tolerance_is_valid(t)
174+
assert within_tolerance(
175+
t, value={
176+
'foo': {"baz": [["hello"], ["joe"]]}
177+
}
178+
) is True
179+
155180
t = {
156181
"type": "jsonpath",
157182
"path": "$.foo[?(@.baz)].baz",
@@ -201,7 +226,7 @@ def test_tolerance_jsonpath_must_match_expected_values():
201226
assert within_tolerance(
202227
t, value={
203228
'foo': [{"baz": "hello"}, {"baz": "bonjour"}]
204-
},
229+
},
205230
) is True
206231

207232

0 commit comments

Comments
 (0)