Coverage for tests / test_completion / test_completion_choice.py: 100%
13 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-09 00:15 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-09 00:15 +0000
1import os 1abcdefg
2import subprocess 1abcdefg
3import sys 1abcdefg
5from . import choice_example as mod 1abcdefg
8def test_script() -> None: 1abcdefg
9 result = subprocess.run( 1abcdefg
10 [sys.executable, "-m", "coverage", "run", mod.__file__, "--name", "rick"],
11 capture_output=True,
12 encoding="utf-8",
13 )
14 assert result.returncode == 0 1abcdefg
15 assert "rick" in result.stdout 1abcdefg
18def test_completion_choice_bash() -> None: 1abcdefg
19 result = subprocess.run( 1abcdefg
20 [sys.executable, "-m", "coverage", "run", mod.__file__, " "],
21 capture_output=True,
22 encoding="utf-8",
23 env={
24 **os.environ,
25 "_CHOICE_EXAMPLE.PY_COMPLETE": "complete_bash",
26 "COMP_WORDS": "choice_example.py --name mo",
27 "COMP_CWORD": "2",
28 },
29 )
30 assert result.returncode == 0 1abcdefg
31 assert "morty" in result.stdout 1abcdefg
32 assert "rick" not in result.stdout 1abcdefg