Skip to content

Commit 8bf8776

Browse files
NRL-1215 Add more prints for test report
1 parent 8c54886 commit 8bf8776

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

layer/nrlf/core/json_duplicate_checker.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def check_for_duplicate_keys(pairs: list[tuple[str, Any]]) -> dict:
1212
print(f"Processing key: {key}, value: {value}")
1313
if normalized_key in normalized_keys:
1414
dupes.setdefault(key, []).append(value)
15+
print(f"Duplicate key found: {key}")
1516
else:
1617
keys[key] = value
1718
normalized_keys += [normalized_key]
@@ -61,13 +62,19 @@ def check_duplicate_keys(json_content: str) -> tuple[list[str], list[str]]:
6162
the same object, regardless of nesting level or array position.
6263
"""
6364
try:
65+
print("JSON content to be processed:")
66+
print(json_content)
67+
print("================================")
6468
dupe_data = json.loads(json_content, object_pairs_hook=check_for_duplicate_keys)
6569
duplicate_paths = [
6670
f"root.{format_path(path)}" for path in flatten_duplicates(dupe_data)
6771
]
6872
duplicate_keys = list(
6973
dict.fromkeys([key.split(".")[-1] for key in duplicate_paths])
7074
)
75+
print("================================")
76+
print(f"Duplicate keys: {duplicate_keys}")
77+
print(f"Duplicate paths: {duplicate_paths}")
7178
return duplicate_keys, duplicate_paths
7279
except json.JSONDecodeError:
7380
raise ValueError("Error: Invalid JSON format")

0 commit comments

Comments
 (0)