Skip to content

Commit 41a2961

Browse files
committed
fix(tests): update mock SAG to use valid JSON-LD graph structure
1 parent c6bc4a3 commit 41a2961

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tests/unit/test_decompose.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ def test_create_sag_success(self, decomposer):
2222
valid_jsonld = '''
2323
{
2424
"@context": "https://schema.org",
25-
"@type": "Claim",
26-
"text": "The earth is flat."
25+
"@graph": [
26+
{
27+
"@type": "Claim",
28+
"label": "The earth is flat."
29+
}
30+
]
2731
}
2832
'''
2933
decomposer.llm_client.call.return_value = f"```json\n{valid_jsonld}\n```"
@@ -33,8 +37,9 @@ def test_create_sag_success(self, decomposer):
3337

3438
# 3. Assess
3539
assert isinstance(result, dict)
36-
assert result.get("@type") == "Claim"
37-
assert result.get("text") == "The earth is flat."
40+
graph = result.get("@graph")
41+
assert len(graph) == 1
42+
assert graph[0].get("label") == "The earth is flat."
3843

3944
# Verify LLM was called
4045
decomposer.llm_client.call.assert_called_once()
@@ -45,12 +50,12 @@ def test_create_sag_retry_logic(self, decomposer):
4550
# First call raises error (invalid json), second call succeeds
4651
decomposer.llm_client.call.side_effect = [
4752
"Invalid JSON",
48-
'''{"@type": "Claim", "text": "Retry success"}'''
53+
'''{"@graph": [{"label": "Retry success"}]}'''
4954
]
5055

5156
result = decomposer.create_sag("test doc", num_retries=2)
5257

53-
assert result.get("text") == "Retry success"
58+
assert result.get("@graph")[0].get("label") == "Retry success"
5459
assert decomposer.llm_client.call.call_count == 2
5560

5661
def test_deduplicate_claims(self, decomposer):

0 commit comments

Comments
 (0)