Skip to content

Commit f535de0

Browse files
committed
refactor: parametrize transcript fixtures directly rather than via flags
1 parent a68e91b commit f535de0

1 file changed

Lines changed: 20 additions & 15 deletions

File tree

‎tests/test_scanners.py‎

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,33 +75,38 @@ async def test_citing_scanner_skips_items_without_ids_and_keeps_cites_contiguous
7575

7676

7777
@pytest.mark.parametrize(
78-
("with_messages", "with_events", "expected_message_cites", "expected_event_cites"),
78+
("messages", "events", "expected_message_cites", "expected_event_cites"),
7979
[
80-
pytest.param(True, False, ["[M1]", "[M2]"], [], id="messages-but-no-events"),
81-
pytest.param(False, True, [], ["[E1]"], id="events-but-no-messages"),
80+
pytest.param(
81+
[
82+
ChatMessageUser(id="m1", content="hello"),
83+
ChatMessageAssistant(id="m2", content="hi"),
84+
],
85+
[],
86+
["[M1]", "[M2]"],
87+
[],
88+
id="messages-but-no-events",
89+
),
90+
pytest.param(
91+
[],
92+
[InfoEvent(data={"note": "hello"})],
93+
[],
94+
["[E1]"],
95+
id="events-but-no-messages",
96+
),
8297
],
8398
)
8499
@pytest.mark.asyncio
85100
async def test_citing_scanner_populates_reference_kinds_independently(
86-
with_messages: bool,
87-
with_events: bool,
101+
messages: list[ChatMessage],
102+
events: list[Event],
88103
expected_message_cites: list[str],
89104
expected_event_cites: list[str],
90105
) -> None:
91106
# Each reference kind is populated from its own collection, so a transcript
92107
# carrying only one kind must yield references of that kind and an empty
93108
# list for the other. Exercised in both directions: the two must not be
94109
# coupled, and neither may suppress the other.
95-
messages: list[ChatMessage] = (
96-
[
97-
ChatMessageUser(id="m1", content="hello"),
98-
ChatMessageAssistant(id="m2", content="hi"),
99-
]
100-
if with_messages
101-
else []
102-
)
103-
events: list[Event] = [InfoEvent(data={"note": "hello"})] if with_events else []
104-
105110
transcript = Transcript(transcript_id="t3", messages=messages, events=events)
106111
result = await citing_scanner()(transcript)
107112
assert isinstance(result, Result)

0 commit comments

Comments
 (0)