| 23 | |
| 24 | |
| 25 | class 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 | |
| 50 | class SourceRefTests(unittest.TestCase): |
nothing calls this directly
no outgoing calls
no test coverage detected