Coverage for tests / test_tutorial / test_commands / test_index / test_tutorial005.py: 100%
15 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.commands.index import tutorial005 as mod 1abcdefghij
5app = mod.app 1abcdefghij
6runner = CliRunner() 1abcdefghij
9def test_creates_successfully(): 1abcdefghij
10 """Verify the example runs without errors"""
11 result = runner.invoke(app, ["create"]) 1abcdefghij
12 assert result.exit_code == 0 1abcdefghij
13 assert "Creating..." in result.output 1abcdefghij
15 result = runner.invoke(app, ["delete"]) 1abcdefghij
16 assert result.exit_code == 0 1abcdefghij
17 assert "Deleting..." in result.output 1abcdefghij
20def test_shows_suggestion(): 1abcdefghij
21 """Verify command suggestions appear for typos"""
22 result = runner.invoke(app, ["crate"]) 1abcdefghij
23 assert result.exit_code != 0 1abcdefghij
24 assert "Did you mean 'create'?" in result.output 1abcdefghij