Coverage for tests / test_tutorial / test_one_file_per_command / test_tutorial.py: 100%
25 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-02-09 12:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-02-09 12:36 +0000
1from typer.testing import CliRunner 1abcdefgh
3from docs_src.one_file_per_command.app_py39 import main as mod 1abcdefgh
5runner = CliRunner() 1abcdefgh
8def test_help(): 1abcdefgh
9 result = runner.invoke(mod.app, ["--help"]) 1abcdefgh
11 assert result.exit_code == 0 1abcdefgh
13 assert "version" in result.output 1abcdefgh
14 assert "users" in result.output 1abcdefgh
17def test_version(): 1abcdefgh
18 result = runner.invoke(mod.app, ["version"]) 1abcdefgh
20 assert result.exit_code == 0 1abcdefgh
21 assert "My CLI Version 1.0" in result.output 1abcdefgh
24def test_users_help(): 1abcdefgh
25 result = runner.invoke(mod.app, ["users", "--help"]) 1abcdefgh
27 assert result.exit_code == 0 1abcdefgh
29 assert "add" in result.output 1abcdefgh
30 assert "delete" in result.output 1abcdefgh
33def test_add_user(): 1abcdefgh
34 result = runner.invoke(mod.app, ["users", "add", "Camila"]) 1abcdefgh
36 assert result.exit_code == 0 1abcdefgh
37 assert "Adding user: Camila" in result.output 1abcdefgh
40def test_delete_user(): 1abcdefgh
41 result = runner.invoke(mod.app, ["users", "delete", "Camila"]) 1abcdefgh
43 assert result.exit_code == 0 1abcdefgh
44 assert "Deleting user: Camila" in result.output 1abcdefgh