File size: 1,301 Bytes
2e818da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from app.schemas.commit_adaptation import CommitAdaptationReview, InteractionQuote, MemoryProposal


def test_commit_adaptation_review_round_trips_valid_payload():
    review = CommitAdaptationReview(
        memory_proposals=[
            MemoryProposal(
                proposal_id="p1",
                destination="student",
                kind="preferred_name",
                statement="The student prefers to be called Anshuman.",
                interaction_ids=["interaction-1"],
                evidence_quotes=[InteractionQuote(interaction_id="interaction-1", quote="call me Anshuman")],
                confidence=0.95,
            )
        ],
        inferred_persona_text="Introduce concepts incrementally.",
    )
    assert review.memory_proposals[0].destination == "student"
    assert review.inferred_persona_text == "Introduce concepts incrementally."


def test_memory_proposal_rejects_unknown_destination():
    import pytest
    from pydantic import ValidationError

    with pytest.raises(ValidationError):
        MemoryProposal(
            proposal_id="p1",
            destination="global",  # not a valid Literal value
            kind="x",
            statement="x",
            interaction_ids=[],
            evidence_quotes=[],
            confidence=0.5,
        )