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