@@ -911,6 +911,49 @@ def test_add_fact_in_bulk_comprehensive(self):
911911 assert any ("Invalid static value" in msg for msg in warning_messages ), \
912912 "Expected warning about invalid static value"
913913
914+ def test_add_fact_in_bulk_no_header_file (self ):
915+ """Test loading facts from CSV file without header using example_facts_no_header.csv.
916+
917+ This test verifies that:
918+ - CSV without header is detected correctly (no header row skipped)
919+ - Valid facts are loaded (node facts, edge facts with intervals)
920+ - Invalid facts produce appropriate warnings
921+
922+ The example_facts_no_header.csv contains:
923+ - Row 1: Viewed(Alice) - valid node fact
924+ - Row 2: Viewed(Bob) - valid node fact
925+ - Row 3: Connected(Alice,Bob):[0.7,0.9] - valid edge fact with interval
926+ - Row 4: empty fact_text - should warn
927+ - Row 5: InvalidNoParens - missing parentheses, should warn
928+ - Row 6: Viewed(Charlie) with bad start_time - should warn
929+ """
930+ csv_path = os .path .join (os .path .dirname (__file__ ), 'test_files' , 'example_facts_no_header.csv' )
931+
932+ # Expect warnings for rows with invalid data:
933+ # - Row 4: empty fact_text -> "Missing required 'fact_text'"
934+ # - Row 5: invalid syntax (missing parentheses) -> "Failed to parse fact"
935+ # - Row 6: invalid start_time -> "Invalid start_time"
936+ with pytest .warns (UserWarning ) as warning_list :
937+ pr .add_fact_in_bulk (csv_path )
938+
939+ # Verify we got at least 3 warnings from the invalid rows
940+ assert len (warning_list ) >= 3 , f"Expected at least 3 warnings, got { len (warning_list )} : { [str (w .message ) for w in warning_list ]} "
941+
942+ # Check that specific warning messages appear
943+ warning_messages = [str (w .message ) for w in warning_list ]
944+
945+ # Verify warning for empty fact_text
946+ assert any ("Missing required 'fact_text'" in msg for msg in warning_messages ), \
947+ "Expected warning about missing fact_text"
948+
949+ # Verify warning for invalid syntax (missing parentheses)
950+ assert any ("Failed to parse fact" in msg for msg in warning_messages ), \
951+ "Expected warning about invalid syntax"
952+
953+ # Verify warning for invalid start_time
954+ assert any ("Invalid start_time" in msg for msg in warning_messages ), \
955+ "Expected warning about invalid start_time"
956+
914957 def test_add_fact_in_bulk_without_header (self ):
915958 """Test loading facts from CSV without header row."""
916959 csv_content = """Viewed(Alice),fact-alice,0,5,False
0 commit comments