Skip to content

Commit

Permalink
Fixed zip() call to be compatible with Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
vthorsteinsson committed Oct 23, 2023
1 parent 6c68297 commit 15070a3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions evals/elsuite/basic/json_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ def json_match(sampled_json: Any, correct_json: Any) -> bool:
if isinstance(correct_json, list):
slist = cast(List[Any], sampled_json)
clist = cast(List[Any], correct_json)
try:
return all(json_match(s, c) for s, c in zip(slist, clist, strict=True))
except ValueError:
# One of the lists is longer than the other
if len(slist) != len(clist):
# Lists must have the same length
return False
return all(json_match(s, c) for s, c in zip(slist, clist))
else:
return False
# Not a structured item: do a direct comparison
Expand Down

0 comments on commit 15070a3

Please sign in to comment.