test: assert typing-stop-before-callback as an invariant, not a call count
The shared _stop_typing_refresh cleanup makes up to two bounded stop_typing attempts; the old assertion pinned exactly one typing-stopped event before callback-start.
This commit is contained in:
@@ -1121,7 +1121,15 @@ async def test_base_processing_stops_typing_before_hung_post_delivery_callback(
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert [call["content"] for call in adapter.sent] == ["done"]
|
assert [call["content"] for call in adapter.sent] == ["done"]
|
||||||
assert events[:2] == ["typing-stopped", "callback-start"]
|
# Invariant: typing must stop before the (hung) post-delivery callback
|
||||||
|
# starts. Don't pin the exact stop_typing call count — the shared
|
||||||
|
# cleanup path may make more than one bounded stop attempt.
|
||||||
|
assert "typing-stopped" in events
|
||||||
|
assert "callback-start" in events
|
||||||
|
assert events.index("typing-stopped") < events.index("callback-start")
|
||||||
|
assert events[: events.index("callback-start")] == (
|
||||||
|
["typing-stopped"] * events.index("callback-start")
|
||||||
|
)
|
||||||
assert any(call["metadata"] == {"stopped": True} for call in adapter.typing)
|
assert any(call["metadata"] == {"stopped": True} for call in adapter.typing)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user