text: import os
  import subprocess
  
  from docs_src.first_steps import tutorial001 as mod
  
  
  def test_completion_show_no_shell():
      result = subprocess.run(
          ["coverage", "run", mod.__file__, "--show-completion"],
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          encoding="utf-8",
          env={
              **os.environ,
              "_TYPER_COMPLETE_TESTING": "True",
              "_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
          },
      )
      # TODO: when deprecating Click 7, remove second option
      assert (
          "Error: Option '--show-completion' requires an argument" in result.stderr
          or "Error: --show-completion option requires an argument" in result.stderr
      )
  
  
  def test_completion_show_bash():
      result = subprocess.run(
          ["coverage", "run", mod.__file__, "--show-completion", "bash"],
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          encoding="utf-8",
          env={
              **os.environ,
              "_TYPER_COMPLETE_TESTING": "True",
              "_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
          },
      )
      assert (
          "complete -o default -F _tutorial001py_completion tutorial001.py"
          in result.stdout
      )
  
  
  def test_completion_source_zsh():
      result = subprocess.run(
          ["coverage", "run", mod.__file__, "--show-completion", "zsh"],
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          encoding="utf-8",
          env={
              **os.environ,
              "_TYPER_COMPLETE_TESTING": "True",
              "_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
          },
      )
      assert "compdef _tutorial001py_completion tutorial001.py" in result.stdout
  
  
  def test_completion_source_fish():
      result = subprocess.run(
          ["coverage", "run", mod.__file__, "--show-completion", "fish"],
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          encoding="utf-8",
          env={
              **os.environ,
              "_TYPER_COMPLETE_TESTING": "True",
              "_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
          },
      )
      assert "complete --command tutorial001.py --no-files" in result.stdout
  
  
  def test_completion_source_powershell():
      result = subprocess.run(
          ["coverage", "run", mod.__file__, "--show-completion", "powershell"],
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          encoding="utf-8",
          env={
              **os.environ,
              "_TYPER_COMPLETE_TESTING": "True",
              "_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
          },
      )
      assert (
          "Register-ArgumentCompleter -Native -CommandName tutorial001.py -ScriptBlock $scriptblock"
          in result.stdout
      )
  
  
  def test_completion_source_pwsh():
      result = subprocess.run(
          ["coverage", "run", mod.__file__, "--show-completion", "pwsh"],
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          encoding="utf-8",
          env={
              **os.environ,
              "_TYPER_COMPLETE_TESTING": "True",
              "_TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION": "True",
          },
      )
      assert (
          "Register-ArgumentCompleter -Native -CommandName tutorial001.py -ScriptBlock $scriptblock"
          in result.stdout
      )
  