Coverage for tests/test_completion/test_completion_complete_no_help.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1import os 1abcdefgh

2import subprocess 1abcdefgh

3import sys 1abcdefgh

4 

5from docs_src.commands.index import tutorial002 as mod 1abcdefgh

6 

7 

8def test_completion_complete_subcommand_zsh(): 1abcdefgh

9 result = subprocess.run( 1abcdefgh

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

11 capture_output=True, 

12 encoding="utf-8", 

13 env={ 

14 **os.environ, 

15 "_TUTORIAL002.PY_COMPLETE": "complete_zsh", 

16 "_TYPER_COMPLETE_ARGS": "tutorial002.py ", 

17 }, 

18 ) 

19 assert "create" in result.stdout 1abcdefgh

20 assert "delete" in result.stdout 1abcdefgh

21 

22 

23def test_completion_complete_subcommand_fish(): 1abcdefgh

24 result = subprocess.run( 1abcdefgh

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

26 capture_output=True, 

27 encoding="utf-8", 

28 env={ 

29 **os.environ, 

30 "_TUTORIAL002.PY_COMPLETE": "complete_fish", 

31 "_TYPER_COMPLETE_ARGS": "tutorial002.py ", 

32 "_TYPER_COMPLETE_FISH_ACTION": "get-args", 

33 }, 

34 ) 

35 assert "create\ndelete" in result.stdout 1abcdefgh

36 

37 

38def test_completion_complete_subcommand_powershell(): 1abcdefgh

39 result = subprocess.run( 1abcdefgh

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

41 capture_output=True, 

42 encoding="utf-8", 

43 env={ 

44 **os.environ, 

45 "_TUTORIAL002.PY_COMPLETE": "complete_powershell", 

46 "_TYPER_COMPLETE_ARGS": "tutorial002.py ", 

47 }, 

48 ) 

49 assert ("create::: \ndelete::: ") in result.stdout 1abcdefgh

50 

51 

52def test_completion_complete_subcommand_pwsh(): 1abcdefgh

53 result = subprocess.run( 1abcdefgh

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

55 capture_output=True, 

56 encoding="utf-8", 

57 env={ 

58 **os.environ, 

59 "_TUTORIAL002.PY_COMPLETE": "complete_pwsh", 

60 "_TYPER_COMPLETE_ARGS": "tutorial002.py ", 

61 }, 

62 ) 

63 assert ("create::: \ndelete::: ") in result.stdout 1abcdefgh