Skip to content

Commit ee0ea04

Browse files
committed
Fix api test file loading
1 parent 83a2452 commit ee0ea04

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

tests/api_tests/test_pyreason_file_loading.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -873,20 +873,20 @@ def test_add_fact_in_bulk_comprehensive(self):
873873
- Invalid static value (should warn)
874874
- Empty optional fields
875875
"""
876-
csv_path = 'pyreason/tests/api_tests/test_files/example_facts.csv'
876+
csv_path = os.path.join(os.path.dirname(__file__), 'test_files', 'example_facts.csv')
877877

878878
# Expect warnings for rows with invalid data:
879-
# - Row with empty fact_text
880-
# - Row with invalid syntax (missing parentheses)
881-
# - Row with out-of-range interval values
882-
# - Row with invalid start_time
883-
# - Row with invalid end_time
884-
# - Row with invalid static value
879+
# - Row 13: empty fact_text -> "Missing required 'fact_text'"
880+
# - Row 14: invalid syntax (missing parentheses) -> "Failed to parse fact"
881+
# - Row 15: out-of-range interval values -> "Failed to parse fact"
882+
# - Row 16: invalid start_time -> "Invalid start_time"
883+
# - Row 17: invalid end_time -> "Invalid end_time"
884+
# - Row 18: invalid static value -> "Invalid static value"
885885
with pytest.warns(UserWarning) as warning_list:
886886
pr.add_fact_in_bulk(csv_path)
887887

888-
# Verify that we got warnings (at least 6 from the invalid rows)
889-
assert len(warning_list) >= 6, f"Expected at least 6 warnings, got {len(warning_list)}"
888+
# Verify that we got exactly 6 warnings from the invalid rows
889+
assert len(warning_list) >= 6, f"Expected at least 6 warnings, got {len(warning_list)}: {[str(w.message) for w in warning_list]}"
890890

891891
# Check that specific warning messages appear
892892
warning_messages = [str(w.message) for w in warning_list]
@@ -895,8 +895,8 @@ def test_add_fact_in_bulk_comprehensive(self):
895895
assert any("Missing required 'fact_text'" in msg for msg in warning_messages), \
896896
"Expected warning about missing fact_text"
897897

898-
# Verify warning for invalid syntax
899-
assert any("Failed to parse fact" in msg and "bad-syntax" in msg for msg in warning_messages), \
898+
# Verify warning for invalid syntax (missing parentheses)
899+
assert any("Failed to parse fact" in msg for msg in warning_messages), \
900900
"Expected warning about invalid syntax"
901901

902902
# Verify warning for invalid start_time

0 commit comments

Comments
 (0)