From 41d8e35dbf7c6eee3c55f5da0d19023283b55da3 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 23:04:56 +0000 Subject: [PATCH] test: add complete pipeline test for rule_based_extract Adds `test_rule_based_extract_complete_pipeline` in `tests/test_extraction_rules.py` to test the full pipeline behavior of `rule_based_extract`. This includes verifying correct extraction of entities, relations, and temporal context in a single integration test case, ensuring high-level validation of the rule-based subsystem without depending on LLMs. Co-authored-by: wjohns989 <56205870+wjohns989@users.noreply.github.com> --- tests/test_extraction_rules.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_extraction_rules.py b/tests/test_extraction_rules.py index 3764a64..71e50a9 100644 --- a/tests/test_extraction_rules.py +++ b/tests/test_extraction_rules.py @@ -72,3 +72,29 @@ def test_file_path_extraction(self): result = rule_based_extract("Edit the file src/main.py to fix the bug") entity_names = [e.name for e in result.entities] assert any("main.py" in n for n in entity_names) + + def test_rule_based_extract_complete_pipeline(self): + """Test rule_based_extract with a complete input that tests all extraction parts.""" + text = "I prefer Python. Python requires Docker. I built this on 2024-01-01." + result = rule_based_extract(text) + + assert isinstance(result, ExtractionResult) + + # Test Entities + entity_names = [e.name for e in result.entities] + assert "Python" in entity_names + assert "Docker" in entity_names + + # Test Relations + assert len(result.relations) == 2 + + pref_relation = next(r for r in result.relations if r.predicate == "prefers") + assert pref_relation.subject == "user" + assert pref_relation.object == "Python" + + dep_relation = next(r for r in result.relations if r.predicate == "depends_on") + assert dep_relation.subject == "Python" + assert dep_relation.object == "Docker" + + # Test Temporal Context + assert result.temporal_context == "2024-01-01"