Coverage for tests/test_tutorial/test_commands/test_index/test_tutorial005.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1from typer.testing import CliRunner 1abcdefghi

2 

3from docs_src.commands.index import tutorial005 as mod 1abcdefghi

4 

5app = mod.app 1abcdefghi

6runner = CliRunner() 1abcdefghi

7 

8 

9def test_creates_successfully(): 1abcdefghi

10 """Verify the example runs without errors""" 

11 result = runner.invoke(app, ["create"]) 1abcdefghi

12 assert result.exit_code == 0 1abcdefghi

13 assert "Creating..." in result.output 1abcdefghi

14 

15 result = runner.invoke(app, ["delete"]) 1abcdefghi

16 assert result.exit_code == 0 1abcdefghi

17 assert "Deleting..." in result.output 1abcdefghi

18 

19 

20def test_shows_suggestion(): 1abcdefghi

21 """Verify command suggestions appear for typos""" 

22 result = runner.invoke(app, ["crate"]) 1abcdefghi

23 assert result.exit_code != 0 1abcdefghi

24 assert "Did you mean 'create'?" in result.output 1abcdefghi