def test_extract_citation_spans(self):
        """Test that citation spans are correctly extracted with positions."""
        # Simple case with one citation
        text = "This is a test with a citation [abc1234]."
        spans = extract_citation_spans(text)
        assert len(spans) == 1, "Should extract one citation ID"
        assert "abc1234" in spans, "Citation ID should be a key in the dictionary"
        assert len(spans["abc1234"]) == 1, "Should have one span for this citation"
        start, end = spans["abc1234"][0]
        assert text[start:end] == "[abc1234]", "Span positions should be correct"

        # Multiple citations
        text = "First citation [abc1234] and second citation [def5678]."
        spans = extract_citation_spans(text)
        assert len(spans) == 2, "Should extract two citation IDs"
        assert "abc1234" in spans, "First citation ID should be present"
        assert "def5678" in spans, "Second citation ID should be present"
        assert len(spans["abc1234"]) == 1, "Should have one span for first citation"
        assert len(spans["def5678"]) == 1, "Should have one span for second citation"
        start1, end1 = spans["abc1234"][0]
        start2, end2 = spans["def5678"][0]
        assert text[start1:end1] == "[abc1234]", "First span positions should be correct"
        assert text[start2:end2] == "[def5678]", "Second span positions should be correct"
Test that citation spans are correctly extracted with positions.
py/tests/unit/retrieval/test_citations.py