MCPcopy
hub / github.com/huggingface/smolagents / test_cli_main

Function test_cli_main

tests/test_cli.py:62–84  ·  view source on GitHub ↗
(capsys)

Source from the content-addressed store, hash-verified

60
61
62def test_cli_main(capsys):
63 with patch("smolagents.cli.load_model") as mock_load_model:
64 mock_load_model.return_value = "mock_model"
65 with patch("smolagents.cli.CodeAgent") as mock_code_agent:
66 from smolagents.cli import run_smolagent
67
68 run_smolagent("test_prompt", [], "InferenceClientModel", "test_model_id", provider="hf-inference")
69 # load_model
70 assert len(mock_load_model.call_args_list) == 1
71 assert mock_load_model.call_args.args == ("InferenceClientModel", "test_model_id")
72 assert mock_load_model.call_args.kwargs == {"api_base": None, "api_key": None, "provider": "hf-inference"}
73 # CodeAgent
74 assert len(mock_code_agent.call_args_list) == 1
75 assert mock_code_agent.call_args.args == ()
76 assert mock_code_agent.call_args.kwargs == {
77 "tools": [],
78 "model": "mock_model",
79 "additional_authorized_imports": None,
80 "stream_outputs": True,
81 }
82 # agent.run
83 assert len(mock_code_agent.return_value.run.call_args_list) == 1
84 assert mock_code_agent.return_value.run.call_args.args == ("test_prompt",)
85
86
87def test_vision_web_browser_main():

Callers

nothing calls this directly

Calls 1

run_smolagentFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…