-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added read method as a smoke test utility
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
def read(node, faulty_docs=[], verbose=False): | ||
if node.structure_family == "container": | ||
for key, child_node in node.items(): | ||
fault_result = read(child_node) | ||
if len(fault_result) > 0: | ||
faulty_docs.append(fault_result) | ||
else: | ||
try: | ||
if verbose: | ||
print(f"reading node with data: {node.item['id']}") | ||
tmp = node.read() # noqa: F841 | ||
except Exception: | ||
if verbose: | ||
print( | ||
f"Node {node.item['id']} does not have a read method or data is fault" | ||
) | ||
faulty_docs.append(node.uri) | ||
return faulty_docs | ||
|
||
return faulty_docs |