(monkeypatch, capsys)
| 14 | |
| 15 | @pytest.mark.asyncio |
| 16 | async def test_run_demo_loop_conversation(monkeypatch, capsys): |
| 17 | model = FakeModel() |
| 18 | model.add_multiple_turn_outputs([[get_text_message("hello")], [get_text_message("good")]]) |
| 19 | |
| 20 | agent = Agent(name="test", model=model) |
| 21 | |
| 22 | inputs = iter(["Hi", "How are you?", "quit"]) |
| 23 | monkeypatch.setattr("builtins.input", lambda _=" > ": next(inputs)) |
| 24 | |
| 25 | await run_demo_loop(agent, stream=False) |
| 26 | |
| 27 | output = capsys.readouterr().out |
| 28 | assert "hello" in output |
| 29 | assert "good" in output |
| 30 | assert model.last_turn_args["input"] == [ |
| 31 | get_text_input_item("Hi"), |
| 32 | get_text_message("hello").model_dump(exclude_unset=True), |
| 33 | get_text_input_item("How are you?"), |
| 34 | ] |
| 35 | |
| 36 | |
| 37 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected