Coverage for tests / test_tutorial / test_multiple_values / test_arguments_with_multiple_values / test_tutorial001.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1import subprocess 1abcdefghij

2import sys 1abcdefghij

3 

4from typer.testing import CliRunner 1abcdefghij

5 

6from docs_src.multiple_values.arguments_with_multiple_values import ( 1abcdefghij

7 tutorial001 as mod, 

8) 

9 

10runner = CliRunner() 1abcdefghij

11app = mod.app 1abcdefghij

12 

13 

14def test_main(): 1abcdefghij

15 result = runner.invoke(app, ["README.md", "pyproject.toml", "woohoo!"]) 1abcdefghij

16 assert result.exit_code == 0 1abcdefghij

17 assert "This file exists: README.md\nwoohoo!" in result.output 1abcdefghij

18 assert "This file exists: pyproject.toml\nwoohoo!" in result.output 1abcdefghij

19 

20 

21def test_script(): 1abcdefghij

22 result = subprocess.run( 1abcdefghij

23 [sys.executable, "-m", "coverage", "run", mod.__file__, "--help"], 

24 capture_output=True, 

25 encoding="utf-8", 

26 ) 

27 assert "Usage" in result.stdout 1abcdefghij