MCPcopy Create free account
hub / github.com/LLMQuant/quant-mind / CitationTests

Class CitationTests

tests/knowledge/test_base.py:25–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class CitationTests(unittest.TestCase):
26 def test_minimal(self):
27 cit = Citation(source_id="arxiv:2604.12345")
28 self.assertEqual(cit.source_id, "arxiv:2604.12345")
29 self.assertIsNone(cit.page)
30 self.assertIsNone(cit.quote)
31 self.assertIsNone(cit.tree_id)
32 self.assertIsNone(cit.node_id)
33
34 def test_quote_max_length(self):
35 with self.assertRaises(ValidationError):
36 Citation(source_id="x", quote="a" * 501)
37
38 def test_tree_anchor_round_trip(self):
39 tree_id = uuid4()
40 node_id = uuid4()
41 cit = Citation(source_id="paper:abc", tree_id=tree_id, node_id=node_id)
42 self.assertEqual(cit.tree_id, tree_id)
43 self.assertEqual(cit.node_id, node_id)
44 # JSON round-trip preserves UUID anchors.
45 revived = Citation.model_validate_json(cit.model_dump_json())
46 self.assertEqual(revived.tree_id, tree_id)
47 self.assertEqual(revived.node_id, node_id)
48
49
50class SourceRefTests(unittest.TestCase):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected