Skip to content

Commit

Permalink
Add missing new files __init__ and utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BibMartin authored and BibMartin committed Mar 13, 2022
1 parent 5329a39 commit 90f6676
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions datasetter/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def doc_equal(doc1, doc2):
"""Test if two JSON-like documents are equel."""
try:
if isinstance(doc1, dict):
assert isinstance(doc2, dict)
for key in doc1.keys():
assert key in doc2 and doc_equal(doc1[key], doc2[key])
elif isinstance(doc1, list):
assert isinstance(doc2, list) and len(doc1) == len(doc2)
for x, y in zip(doc1, doc2):
assert doc_equal(x, y)
else:
assert doc1 == doc2
return True
except AssertionError:
return False
Empty file added test/__init__.py
Empty file.

0 comments on commit 90f6676

Please sign in to comment.