Update cognee/tests/unit/interfaces/graph/util.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
58a733c1d8
commit
af88870076
1 changed files with 15 additions and 1 deletions
|
|
@ -1,9 +1,23 @@
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Dict, Any
|
||||||
|
|
||||||
def run_test_against_ground_truth(
|
def run_test_against_ground_truth(
|
||||||
test_target_item_name, test_target_item, ground_truth_dict
|
test_target_item_name: str,
|
||||||
|
test_target_item: Any,
|
||||||
|
ground_truth_dict: Dict[str, Any]
|
||||||
):
|
):
|
||||||
|
"""Validates test target item attributes against ground truth values.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
test_target_item_name: Name of the item being tested (for error messages)
|
||||||
|
test_target_item: Object whose attributes are being validated
|
||||||
|
ground_truth_dict: Dictionary containing expected values
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
AssertionError: If any attribute doesn't match ground truth or if update timestamp is too old
|
||||||
|
"""
|
||||||
for key, ground_truth in ground_truth_dict.items():
|
for key, ground_truth in ground_truth_dict.items():
|
||||||
if isinstance(ground_truth, dict):
|
if isinstance(ground_truth, dict):
|
||||||
for key2, ground_truth2 in ground_truth.items():
|
for key2, ground_truth2 in ground_truth.items():
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue