Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial003_an.py +36 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial004.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial004_an.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial005.py +54 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial005_an.py +54 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py +51 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py +51 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_required/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_required/test_tutorial001.py +52 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_required/test_tutorial001_an.py +52 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_version/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_version/test_tutorial003.py +56 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_version/test_tutorial003_an.py +56 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py +40 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial002_an.py +40 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py +57 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial003_an.py +57 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py +40 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial004_an.py +40 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py +41 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial007_an.py +41 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial008_an.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial009_an.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py +46 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py +46 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py +64 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py +64 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py +42 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py +46 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py +46 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py +38 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py +38 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py +38 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py +38 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/__init__.py +0 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py +47 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py +33 -0
- miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py +33 -0
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial003_an.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.name import tutorial003_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-n" in result.output
|
| 19 |
+
assert "TEXT" in result.output
|
| 20 |
+
assert "--user-name" not in result.output
|
| 21 |
+
assert "--name" not in result.output
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def test_call():
|
| 25 |
+
result = runner.invoke(app, ["-n", "Camila"])
|
| 26 |
+
assert result.exit_code == 0
|
| 27 |
+
assert "Hello Camila" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_script():
|
| 31 |
+
result = subprocess.run(
|
| 32 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 33 |
+
capture_output=True,
|
| 34 |
+
encoding="utf-8",
|
| 35 |
+
)
|
| 36 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial004.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.name import tutorial004 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-n" in result.output
|
| 19 |
+
assert "--user-name" in result.output
|
| 20 |
+
assert "TEXT" in result.output
|
| 21 |
+
assert "--name" not in result.output
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def test_call():
|
| 25 |
+
result = runner.invoke(app, ["-n", "Camila"])
|
| 26 |
+
assert result.exit_code == 0
|
| 27 |
+
assert "Hello Camila" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_call_long():
|
| 31 |
+
result = runner.invoke(app, ["--user-name", "Camila"])
|
| 32 |
+
assert result.exit_code == 0
|
| 33 |
+
assert "Hello Camila" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial004_an.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.name import tutorial004_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-n" in result.output
|
| 19 |
+
assert "--user-name" in result.output
|
| 20 |
+
assert "TEXT" in result.output
|
| 21 |
+
assert "--name" not in result.output
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def test_call():
|
| 25 |
+
result = runner.invoke(app, ["-n", "Camila"])
|
| 26 |
+
assert result.exit_code == 0
|
| 27 |
+
assert "Hello Camila" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_call_long():
|
| 31 |
+
result = runner.invoke(app, ["--user-name", "Camila"])
|
| 32 |
+
assert result.exit_code == 0
|
| 33 |
+
assert "Hello Camila" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial005.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.name import tutorial005 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-n" in result.output
|
| 19 |
+
assert "--name" in result.output
|
| 20 |
+
assert "TEXT" in result.output
|
| 21 |
+
assert "-f" in result.output
|
| 22 |
+
assert "--formal" in result.output
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_call():
|
| 26 |
+
result = runner.invoke(app, ["-n", "Camila"])
|
| 27 |
+
assert result.exit_code == 0
|
| 28 |
+
assert "Hello Camila" in result.output
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def test_call_formal():
|
| 32 |
+
result = runner.invoke(app, ["-n", "Camila", "-f"])
|
| 33 |
+
assert result.exit_code == 0
|
| 34 |
+
assert "Good day Ms. Camila." in result.output
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_call_formal_condensed():
|
| 38 |
+
result = runner.invoke(app, ["-fn", "Camila"])
|
| 39 |
+
assert result.exit_code == 0
|
| 40 |
+
assert "Good day Ms. Camila." in result.output
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def test_call_condensed_wrong_order():
|
| 44 |
+
result = runner.invoke(app, ["-nf", "Camila"])
|
| 45 |
+
assert result.exit_code != 0
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def test_script():
|
| 49 |
+
result = subprocess.run(
|
| 50 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 51 |
+
capture_output=True,
|
| 52 |
+
encoding="utf-8",
|
| 53 |
+
)
|
| 54 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_name/test_tutorial005_an.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.name import tutorial005_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-n" in result.output
|
| 19 |
+
assert "--name" in result.output
|
| 20 |
+
assert "TEXT" in result.output
|
| 21 |
+
assert "-f" in result.output
|
| 22 |
+
assert "--formal" in result.output
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_call():
|
| 26 |
+
result = runner.invoke(app, ["-n", "Camila"])
|
| 27 |
+
assert result.exit_code == 0
|
| 28 |
+
assert "Hello Camila" in result.output
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def test_call_formal():
|
| 32 |
+
result = runner.invoke(app, ["-n", "Camila", "-f"])
|
| 33 |
+
assert result.exit_code == 0
|
| 34 |
+
assert "Good day Ms. Camila." in result.output
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_call_formal_condensed():
|
| 38 |
+
result = runner.invoke(app, ["-fn", "Camila"])
|
| 39 |
+
assert result.exit_code == 0
|
| 40 |
+
assert "Good day Ms. Camila." in result.output
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def test_call_condensed_wrong_order():
|
| 44 |
+
result = runner.invoke(app, ["-nf", "Camila"])
|
| 45 |
+
assert result.exit_code != 0
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def test_script():
|
| 49 |
+
result = subprocess.run(
|
| 50 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 51 |
+
capture_output=True,
|
| 52 |
+
encoding="utf-8",
|
| 53 |
+
)
|
| 54 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial001.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.prompt import tutorial001 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_lastname():
|
| 16 |
+
result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_option_lastname_prompt():
|
| 22 |
+
result = runner.invoke(app, ["Camila"], input="Gutiérrez")
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Lastname: " in result.output
|
| 25 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_help():
|
| 29 |
+
result = runner.invoke(app, ["--help"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "--lastname" in result.output
|
| 32 |
+
assert "TEXT" in result.output
|
| 33 |
+
assert "[required]" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.prompt import tutorial001_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_lastname():
|
| 16 |
+
result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_option_lastname_prompt():
|
| 22 |
+
result = runner.invoke(app, ["Camila"], input="Gutiérrez")
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Lastname: " in result.output
|
| 25 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_help():
|
| 29 |
+
result = runner.invoke(app, ["--help"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "--lastname" in result.output
|
| 32 |
+
assert "TEXT" in result.output
|
| 33 |
+
assert "[required]" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial002.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.prompt import tutorial002 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_lastname():
|
| 16 |
+
result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_option_lastname_prompt():
|
| 22 |
+
result = runner.invoke(app, ["Camila"], input="Gutiérrez")
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Please tell me your last name: " in result.output
|
| 25 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_help():
|
| 29 |
+
result = runner.invoke(app, ["--help"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "--lastname" in result.output
|
| 32 |
+
assert "TEXT" in result.output
|
| 33 |
+
assert "[required]" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.prompt import tutorial002_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_option_lastname():
|
| 16 |
+
result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_option_lastname_prompt():
|
| 22 |
+
result = runner.invoke(app, ["Camila"], input="Gutiérrez")
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Please tell me your last name: " in result.output
|
| 25 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_help():
|
| 29 |
+
result = runner.invoke(app, ["--help"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "--lastname" in result.output
|
| 32 |
+
assert "TEXT" in result.output
|
| 33 |
+
assert "[required]" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial003.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.prompt import tutorial003 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_prompt():
|
| 16 |
+
result = runner.invoke(app, input="Old Project\nOld Project\n")
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Deleting project Old Project" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_prompt_not_equal():
|
| 22 |
+
result = runner.invoke(
|
| 23 |
+
app, input="Old Project\nNew Spice\nOld Project\nOld Project\n"
|
| 24 |
+
)
|
| 25 |
+
assert result.exit_code == 0
|
| 26 |
+
assert "Error: The two entered values do not match" in result.output
|
| 27 |
+
assert "Deleting project Old Project" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_option():
|
| 31 |
+
result = runner.invoke(app, ["--project-name", "Old Project"])
|
| 32 |
+
assert result.exit_code == 0
|
| 33 |
+
assert "Deleting project Old Project" in result.output
|
| 34 |
+
assert "Project name: " not in result.output
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_help():
|
| 38 |
+
result = runner.invoke(app, ["--help"])
|
| 39 |
+
assert result.exit_code == 0
|
| 40 |
+
assert "--project-name" in result.output
|
| 41 |
+
assert "TEXT" in result.output
|
| 42 |
+
assert "[required]" in result.output
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def test_script():
|
| 46 |
+
result = subprocess.run(
|
| 47 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 48 |
+
capture_output=True,
|
| 49 |
+
encoding="utf-8",
|
| 50 |
+
)
|
| 51 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options.prompt import tutorial003_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_prompt():
|
| 16 |
+
result = runner.invoke(app, input="Old Project\nOld Project\n")
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Deleting project Old Project" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_prompt_not_equal():
|
| 22 |
+
result = runner.invoke(
|
| 23 |
+
app, input="Old Project\nNew Spice\nOld Project\nOld Project\n"
|
| 24 |
+
)
|
| 25 |
+
assert result.exit_code == 0
|
| 26 |
+
assert "Error: The two entered values do not match" in result.output
|
| 27 |
+
assert "Deleting project Old Project" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_option():
|
| 31 |
+
result = runner.invoke(app, ["--project-name", "Old Project"])
|
| 32 |
+
assert result.exit_code == 0
|
| 33 |
+
assert "Deleting project Old Project" in result.output
|
| 34 |
+
assert "Project name: " not in result.output
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_help():
|
| 38 |
+
result = runner.invoke(app, ["--help"])
|
| 39 |
+
assert result.exit_code == 0
|
| 40 |
+
assert "--project-name" in result.output
|
| 41 |
+
assert "TEXT" in result.output
|
| 42 |
+
assert "[required]" in result.output
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def test_script():
|
| 46 |
+
result = subprocess.run(
|
| 47 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 48 |
+
capture_output=True,
|
| 49 |
+
encoding="utf-8",
|
| 50 |
+
)
|
| 51 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_required/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_required/test_tutorial001.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
import typer
|
| 6 |
+
import typer.core
|
| 7 |
+
from typer.testing import CliRunner
|
| 8 |
+
|
| 9 |
+
from docs_src.options.required import tutorial001 as mod
|
| 10 |
+
|
| 11 |
+
runner = CliRunner()
|
| 12 |
+
|
| 13 |
+
app = typer.Typer()
|
| 14 |
+
app.command()(mod.main)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def test_1():
|
| 18 |
+
result = runner.invoke(app, ["Camila"])
|
| 19 |
+
assert result.exit_code != 0
|
| 20 |
+
assert "Missing option '--lastname'" in result.output
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def test_option_lastname():
|
| 24 |
+
result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])
|
| 25 |
+
assert result.exit_code == 0
|
| 26 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_help():
|
| 30 |
+
result = runner.invoke(app, ["--help"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "--lastname" in result.output
|
| 33 |
+
assert "TEXT" in result.output
|
| 34 |
+
assert "[required]" in result.output
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_help_no_rich(monkeypatch: pytest.MonkeyPatch):
|
| 38 |
+
monkeypatch.setattr(typer.core, "HAS_RICH", False)
|
| 39 |
+
result = runner.invoke(app, ["--help"])
|
| 40 |
+
assert result.exit_code == 0
|
| 41 |
+
assert "--lastname" in result.output
|
| 42 |
+
assert "TEXT" in result.output
|
| 43 |
+
assert "[required]" in result.output
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def test_script():
|
| 47 |
+
result = subprocess.run(
|
| 48 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 49 |
+
capture_output=True,
|
| 50 |
+
encoding="utf-8",
|
| 51 |
+
)
|
| 52 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_required/test_tutorial001_an.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
import typer
|
| 6 |
+
import typer.core
|
| 7 |
+
from typer.testing import CliRunner
|
| 8 |
+
|
| 9 |
+
from docs_src.options.required import tutorial001_an as mod
|
| 10 |
+
|
| 11 |
+
runner = CliRunner()
|
| 12 |
+
|
| 13 |
+
app = typer.Typer()
|
| 14 |
+
app.command()(mod.main)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def test_1():
|
| 18 |
+
result = runner.invoke(app, ["Camila"])
|
| 19 |
+
assert result.exit_code != 0
|
| 20 |
+
assert "Missing option '--lastname'" in result.output
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def test_option_lastname():
|
| 24 |
+
result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])
|
| 25 |
+
assert result.exit_code == 0
|
| 26 |
+
assert "Hello Camila Gutiérrez" in result.output
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_help():
|
| 30 |
+
result = runner.invoke(app, ["--help"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "--lastname" in result.output
|
| 33 |
+
assert "TEXT" in result.output
|
| 34 |
+
assert "[required]" in result.output
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def test_help_no_rich(monkeypatch: pytest.MonkeyPatch):
|
| 38 |
+
monkeypatch.setattr(typer.core, "HAS_RICH", False)
|
| 39 |
+
result = runner.invoke(app, ["--help"])
|
| 40 |
+
assert result.exit_code == 0
|
| 41 |
+
assert "--lastname" in result.output
|
| 42 |
+
assert "TEXT" in result.output
|
| 43 |
+
assert "[required]" in result.output
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def test_script():
|
| 47 |
+
result = subprocess.run(
|
| 48 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 49 |
+
capture_output=True,
|
| 50 |
+
encoding="utf-8",
|
| 51 |
+
)
|
| 52 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_version/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_version/test_tutorial003.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
import typer
|
| 6 |
+
from typer.testing import CliRunner
|
| 7 |
+
|
| 8 |
+
from docs_src.options.version import tutorial003 as mod
|
| 9 |
+
|
| 10 |
+
runner = CliRunner()
|
| 11 |
+
|
| 12 |
+
app = typer.Typer()
|
| 13 |
+
app.command()(mod.main)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def test_1():
|
| 17 |
+
result = runner.invoke(app, ["--name", "Rick", "--version"])
|
| 18 |
+
assert result.exit_code == 0
|
| 19 |
+
assert "Awesome CLI Version: 0.1.0" in result.output
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_2():
|
| 23 |
+
result = runner.invoke(app, ["--name", "rick"])
|
| 24 |
+
assert result.exit_code != 0
|
| 25 |
+
assert "Invalid value for '--name'" in result.output
|
| 26 |
+
assert "Only Camila is allowed" in result.output
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_3():
|
| 30 |
+
result = runner.invoke(app, ["--name", "Camila"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "Hello Camila" in result.output
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def test_script():
|
| 36 |
+
result = subprocess.run(
|
| 37 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 38 |
+
capture_output=True,
|
| 39 |
+
encoding="utf-8",
|
| 40 |
+
)
|
| 41 |
+
assert "Usage" in result.stdout
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def test_completion():
|
| 45 |
+
result = subprocess.run(
|
| 46 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 47 |
+
capture_output=True,
|
| 48 |
+
encoding="utf-8",
|
| 49 |
+
env={
|
| 50 |
+
**os.environ,
|
| 51 |
+
"_TUTORIAL003.PY_COMPLETE": "complete_bash",
|
| 52 |
+
"COMP_WORDS": "tutorial003.py --name Rick --v",
|
| 53 |
+
"COMP_CWORD": "3",
|
| 54 |
+
},
|
| 55 |
+
)
|
| 56 |
+
assert "--version" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options/test_version/test_tutorial003_an.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
import typer
|
| 6 |
+
from typer.testing import CliRunner
|
| 7 |
+
|
| 8 |
+
from docs_src.options.version import tutorial003_an as mod
|
| 9 |
+
|
| 10 |
+
runner = CliRunner()
|
| 11 |
+
|
| 12 |
+
app = typer.Typer()
|
| 13 |
+
app.command()(mod.main)
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def test_1():
|
| 17 |
+
result = runner.invoke(app, ["--name", "Rick", "--version"])
|
| 18 |
+
assert result.exit_code == 0
|
| 19 |
+
assert "Awesome CLI Version: 0.1.0" in result.output
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_2():
|
| 23 |
+
result = runner.invoke(app, ["--name", "rick"])
|
| 24 |
+
assert result.exit_code != 0
|
| 25 |
+
assert "Invalid value for '--name'" in result.output
|
| 26 |
+
assert "Only Camila is allowed" in result.output
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_3():
|
| 30 |
+
result = runner.invoke(app, ["--name", "Camila"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "Hello Camila" in result.output
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def test_script():
|
| 36 |
+
result = subprocess.run(
|
| 37 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 38 |
+
capture_output=True,
|
| 39 |
+
encoding="utf-8",
|
| 40 |
+
)
|
| 41 |
+
assert "Usage" in result.stdout
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def test_completion():
|
| 45 |
+
result = subprocess.run(
|
| 46 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 47 |
+
capture_output=True,
|
| 48 |
+
encoding="utf-8",
|
| 49 |
+
env={
|
| 50 |
+
**os.environ,
|
| 51 |
+
"_TUTORIAL003_AN.PY_COMPLETE": "complete_bash",
|
| 52 |
+
"COMP_WORDS": "tutorial003_an.py --name Rick --v",
|
| 53 |
+
"COMP_CWORD": "3",
|
| 54 |
+
},
|
| 55 |
+
)
|
| 56 |
+
assert "--version" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial002.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial002 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL002.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial002.py --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert "Camila" in result.stdout
|
| 24 |
+
assert "Carlos" in result.stdout
|
| 25 |
+
assert "Sebastian" in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_1():
|
| 29 |
+
result = runner.invoke(mod.app, ["--name", "Camila"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Hello Camila" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_script():
|
| 35 |
+
result = subprocess.run(
|
| 36 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 37 |
+
capture_output=True,
|
| 38 |
+
encoding="utf-8",
|
| 39 |
+
)
|
| 40 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial002_an.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial002_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL002_AN.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial002_an.py --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert "Camila" in result.stdout
|
| 24 |
+
assert "Carlos" in result.stdout
|
| 25 |
+
assert "Sebastian" in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_1():
|
| 29 |
+
result = runner.invoke(mod.app, ["--name", "Camila"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Hello Camila" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_script():
|
| 35 |
+
result = subprocess.run(
|
| 36 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 37 |
+
capture_output=True,
|
| 38 |
+
encoding="utf-8",
|
| 39 |
+
)
|
| 40 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial003.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial003 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion_zsh():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL003.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial003.py --name Seb",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert "Camila" not in result.stdout
|
| 24 |
+
assert "Carlos" not in result.stdout
|
| 25 |
+
assert "Sebastian" in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_completion_powershell():
|
| 29 |
+
result = subprocess.run(
|
| 30 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 31 |
+
capture_output=True,
|
| 32 |
+
encoding="utf-8",
|
| 33 |
+
env={
|
| 34 |
+
**os.environ,
|
| 35 |
+
"_TUTORIAL003.PY_COMPLETE": "complete_powershell",
|
| 36 |
+
"_TYPER_COMPLETE_ARGS": "tutorial003.py --name Seb",
|
| 37 |
+
"_TYPER_COMPLETE_WORD_TO_COMPLETE": "Seb",
|
| 38 |
+
},
|
| 39 |
+
)
|
| 40 |
+
assert "Camila" not in result.stdout
|
| 41 |
+
assert "Carlos" not in result.stdout
|
| 42 |
+
assert "Sebastian" in result.stdout
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def test_1():
|
| 46 |
+
result = runner.invoke(mod.app, ["--name", "Camila"])
|
| 47 |
+
assert result.exit_code == 0
|
| 48 |
+
assert "Hello Camila" in result.output
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def test_script():
|
| 52 |
+
result = subprocess.run(
|
| 53 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 54 |
+
capture_output=True,
|
| 55 |
+
encoding="utf-8",
|
| 56 |
+
)
|
| 57 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial003_an.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial003_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion_zsh():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL003_AN.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial003_an.py --name Seb",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert "Camila" not in result.stdout
|
| 24 |
+
assert "Carlos" not in result.stdout
|
| 25 |
+
assert "Sebastian" in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_completion_powershell():
|
| 29 |
+
result = subprocess.run(
|
| 30 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 31 |
+
capture_output=True,
|
| 32 |
+
encoding="utf-8",
|
| 33 |
+
env={
|
| 34 |
+
**os.environ,
|
| 35 |
+
"_TUTORIAL003_AN.PY_COMPLETE": "complete_powershell",
|
| 36 |
+
"_TYPER_COMPLETE_ARGS": "tutorial003.py --name Seb",
|
| 37 |
+
"_TYPER_COMPLETE_WORD_TO_COMPLETE": "Seb",
|
| 38 |
+
},
|
| 39 |
+
)
|
| 40 |
+
assert "Camila" not in result.stdout
|
| 41 |
+
assert "Carlos" not in result.stdout
|
| 42 |
+
assert "Sebastian" in result.stdout
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def test_1():
|
| 46 |
+
result = runner.invoke(mod.app, ["--name", "Camila"])
|
| 47 |
+
assert result.exit_code == 0
|
| 48 |
+
assert "Hello Camila" in result.output
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def test_script():
|
| 52 |
+
result = subprocess.run(
|
| 53 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 54 |
+
capture_output=True,
|
| 55 |
+
encoding="utf-8",
|
| 56 |
+
)
|
| 57 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial004.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial004 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL004.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial004_aux.py --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_1():
|
| 29 |
+
result = runner.invoke(mod.app, ["--name", "Camila"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Hello Camila" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_script():
|
| 35 |
+
result = subprocess.run(
|
| 36 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 37 |
+
capture_output=True,
|
| 38 |
+
encoding="utf-8",
|
| 39 |
+
)
|
| 40 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial004_an.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial004_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL004_AN.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial004_an_aux.py --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_1():
|
| 29 |
+
result = runner.invoke(mod.app, ["--name", "Camila"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Hello Camila" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_script():
|
| 35 |
+
result = subprocess.run(
|
| 36 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 37 |
+
capture_output=True,
|
| 38 |
+
encoding="utf-8",
|
| 39 |
+
)
|
| 40 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial007.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial007 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL007.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial007.py --name Sebastian --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' not in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_1():
|
| 29 |
+
result = runner.invoke(mod.app, ["--name", "Camila", "--name", "Sebastian"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Hello Camila" in result.output
|
| 32 |
+
assert "Hello Sebastian" in result.output
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def test_script():
|
| 36 |
+
result = subprocess.run(
|
| 37 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 38 |
+
capture_output=True,
|
| 39 |
+
encoding="utf-8",
|
| 40 |
+
)
|
| 41 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial007_an.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial007_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL007_AN.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial007_an.py --name Sebastian --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' not in result.stdout
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_1():
|
| 29 |
+
result = runner.invoke(mod.app, ["--name", "Camila", "--name", "Sebastian"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Hello Camila" in result.output
|
| 32 |
+
assert "Hello Sebastian" in result.output
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def test_script():
|
| 36 |
+
result = subprocess.run(
|
| 37 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 38 |
+
capture_output=True,
|
| 39 |
+
encoding="utf-8",
|
| 40 |
+
)
|
| 41 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial008.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial008 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL008.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial008.py --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' in result.stdout
|
| 26 |
+
assert "[]" in result.stderr
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_1():
|
| 30 |
+
result = runner.invoke(mod.app, ["--name", "Camila", "--name", "Sebastian"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "Hello Camila" in result.output
|
| 33 |
+
assert "Hello Sebastian" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial008_an.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial008_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL008_AN.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial008_an.py --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' in result.stdout
|
| 26 |
+
assert "[]" in result.stderr
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_1():
|
| 30 |
+
result = runner.invoke(mod.app, ["--name", "Camila", "--name", "Sebastian"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "Hello Camila" in result.output
|
| 33 |
+
assert "Hello Sebastian" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial009.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial009 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL009.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial009.py --name Sebastian --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' not in result.stdout
|
| 26 |
+
assert "[]" in result.stderr
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_1():
|
| 30 |
+
result = runner.invoke(mod.app, ["--name", "Camila", "--name", "Sebastian"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "Hello Camila" in result.output
|
| 33 |
+
assert "Hello Sebastian" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_options_autocompletion/test_tutorial009_an.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
import sys
|
| 4 |
+
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.options_autocompletion import tutorial009_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def test_completion():
|
| 13 |
+
result = subprocess.run(
|
| 14 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, " "],
|
| 15 |
+
capture_output=True,
|
| 16 |
+
encoding="utf-8",
|
| 17 |
+
env={
|
| 18 |
+
**os.environ,
|
| 19 |
+
"_TUTORIAL009_AN.PY_COMPLETE": "complete_zsh",
|
| 20 |
+
"_TYPER_COMPLETE_ARGS": "tutorial009_an.py --name Sebastian --name ",
|
| 21 |
+
},
|
| 22 |
+
)
|
| 23 |
+
assert '"Camila":"The reader of books."' in result.stdout
|
| 24 |
+
assert '"Carlos":"The writer of scripts."' in result.stdout
|
| 25 |
+
assert '"Sebastian":"The type hints guy."' not in result.stdout
|
| 26 |
+
assert "[]" in result.stderr
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def test_1():
|
| 30 |
+
result = runner.invoke(mod.app, ["--name", "Camila", "--name", "Sebastian"])
|
| 31 |
+
assert result.exit_code == 0
|
| 32 |
+
assert "Hello Camila" in result.output
|
| 33 |
+
assert "Hello Sebastian" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.bool import tutorial001 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "--force" in result.output
|
| 19 |
+
assert "--no-force" not in result.output
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_no_force():
|
| 23 |
+
result = runner.invoke(app)
|
| 24 |
+
assert result.exit_code == 0
|
| 25 |
+
assert "Not forcing" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_force():
|
| 29 |
+
result = runner.invoke(app, ["--force"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Forcing operation" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_invalid_no_force():
|
| 35 |
+
result = runner.invoke(app, ["--no-force"])
|
| 36 |
+
assert result.exit_code != 0
|
| 37 |
+
assert "No such option: --no-force" in result.output
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def test_script():
|
| 41 |
+
result = subprocess.run(
|
| 42 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 43 |
+
capture_output=True,
|
| 44 |
+
encoding="utf-8",
|
| 45 |
+
)
|
| 46 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.bool import tutorial001_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "--force" in result.output
|
| 19 |
+
assert "--no-force" not in result.output
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_no_force():
|
| 23 |
+
result = runner.invoke(app)
|
| 24 |
+
assert result.exit_code == 0
|
| 25 |
+
assert "Not forcing" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_force():
|
| 29 |
+
result = runner.invoke(app, ["--force"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Forcing operation" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_invalid_no_force():
|
| 35 |
+
result = runner.invoke(app, ["--no-force"])
|
| 36 |
+
assert result.exit_code != 0
|
| 37 |
+
assert "No such option: --no-force" in result.output
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def test_script():
|
| 41 |
+
result = subprocess.run(
|
| 42 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 43 |
+
capture_output=True,
|
| 44 |
+
encoding="utf-8",
|
| 45 |
+
)
|
| 46 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
import typer
|
| 6 |
+
import typer.core
|
| 7 |
+
from typer.testing import CliRunner
|
| 8 |
+
|
| 9 |
+
from docs_src.parameter_types.bool import tutorial002 as mod
|
| 10 |
+
|
| 11 |
+
runner = CliRunner()
|
| 12 |
+
|
| 13 |
+
app = typer.Typer()
|
| 14 |
+
app.command()(mod.main)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def test_help():
|
| 18 |
+
result = runner.invoke(app, ["--help"])
|
| 19 |
+
assert result.exit_code == 0
|
| 20 |
+
assert "--accept" in result.output
|
| 21 |
+
assert "--reject" in result.output
|
| 22 |
+
assert "--no-accept" not in result.output
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_help_no_rich(monkeypatch: pytest.MonkeyPatch):
|
| 26 |
+
monkeypatch.setattr(typer.core, "HAS_RICH", False)
|
| 27 |
+
result = runner.invoke(app, ["--help"])
|
| 28 |
+
assert result.exit_code == 0
|
| 29 |
+
assert "--accept" in result.output
|
| 30 |
+
assert "--reject" in result.output
|
| 31 |
+
assert "--no-accept" not in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_main():
|
| 35 |
+
result = runner.invoke(app)
|
| 36 |
+
assert result.exit_code == 0
|
| 37 |
+
assert "I don't know what you want yet" in result.output
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def test_accept():
|
| 41 |
+
result = runner.invoke(app, ["--accept"])
|
| 42 |
+
assert result.exit_code == 0
|
| 43 |
+
assert "Accepting!" in result.output
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def test_reject():
|
| 47 |
+
result = runner.invoke(app, ["--reject"])
|
| 48 |
+
assert result.exit_code == 0
|
| 49 |
+
assert "Rejecting!" in result.output
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def test_invalid_no_accept():
|
| 53 |
+
result = runner.invoke(app, ["--no-accept"])
|
| 54 |
+
assert result.exit_code != 0
|
| 55 |
+
assert "No such option: --no-accept" in result.output
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def test_script():
|
| 59 |
+
result = subprocess.run(
|
| 60 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 61 |
+
capture_output=True,
|
| 62 |
+
encoding="utf-8",
|
| 63 |
+
)
|
| 64 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import pytest
|
| 5 |
+
import typer
|
| 6 |
+
import typer.core
|
| 7 |
+
from typer.testing import CliRunner
|
| 8 |
+
|
| 9 |
+
from docs_src.parameter_types.bool import tutorial002_an as mod
|
| 10 |
+
|
| 11 |
+
runner = CliRunner()
|
| 12 |
+
|
| 13 |
+
app = typer.Typer()
|
| 14 |
+
app.command()(mod.main)
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def test_help():
|
| 18 |
+
result = runner.invoke(app, ["--help"])
|
| 19 |
+
assert result.exit_code == 0
|
| 20 |
+
assert "--accept" in result.output
|
| 21 |
+
assert "--reject" in result.output
|
| 22 |
+
assert "--no-accept" not in result.output
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def test_help_no_rich(monkeypatch: pytest.MonkeyPatch):
|
| 26 |
+
monkeypatch.setattr(typer.core, "HAS_RICH", False)
|
| 27 |
+
result = runner.invoke(app, ["--help"])
|
| 28 |
+
assert result.exit_code == 0
|
| 29 |
+
assert "--accept" in result.output
|
| 30 |
+
assert "--reject" in result.output
|
| 31 |
+
assert "--no-accept" not in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_main():
|
| 35 |
+
result = runner.invoke(app)
|
| 36 |
+
assert result.exit_code == 0
|
| 37 |
+
assert "I don't know what you want yet" in result.output
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def test_accept():
|
| 41 |
+
result = runner.invoke(app, ["--accept"])
|
| 42 |
+
assert result.exit_code == 0
|
| 43 |
+
assert "Accepting!" in result.output
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def test_reject():
|
| 47 |
+
result = runner.invoke(app, ["--reject"])
|
| 48 |
+
assert result.exit_code == 0
|
| 49 |
+
assert "Rejecting!" in result.output
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def test_invalid_no_accept():
|
| 53 |
+
result = runner.invoke(app, ["--no-accept"])
|
| 54 |
+
assert result.exit_code != 0
|
| 55 |
+
assert "No such option: --no-accept" in result.output
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def test_script():
|
| 59 |
+
result = subprocess.run(
|
| 60 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 61 |
+
capture_output=True,
|
| 62 |
+
encoding="utf-8",
|
| 63 |
+
)
|
| 64 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.bool import tutorial003 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-f" in result.output
|
| 19 |
+
assert "--force" in result.output
|
| 20 |
+
assert "-F" in result.output
|
| 21 |
+
assert "--no-force" in result.output
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def test_force():
|
| 25 |
+
result = runner.invoke(app, ["-f"])
|
| 26 |
+
assert result.exit_code == 0
|
| 27 |
+
assert "Forcing operation" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_no_force():
|
| 31 |
+
result = runner.invoke(app, ["-F"])
|
| 32 |
+
assert result.exit_code == 0
|
| 33 |
+
assert "Not forcing" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.bool import tutorial003_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-f" in result.output
|
| 19 |
+
assert "--force" in result.output
|
| 20 |
+
assert "-F" in result.output
|
| 21 |
+
assert "--no-force" in result.output
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def test_force():
|
| 25 |
+
result = runner.invoke(app, ["-f"])
|
| 26 |
+
assert result.exit_code == 0
|
| 27 |
+
assert "Forcing operation" in result.output
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def test_no_force():
|
| 31 |
+
result = runner.invoke(app, ["-F"])
|
| 32 |
+
assert result.exit_code == 0
|
| 33 |
+
assert "Not forcing" in result.output
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
def test_script():
|
| 37 |
+
result = subprocess.run(
|
| 38 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 39 |
+
capture_output=True,
|
| 40 |
+
encoding="utf-8",
|
| 41 |
+
)
|
| 42 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.bool import tutorial004 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-d" in result.output
|
| 19 |
+
assert "--demo" in result.output
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_main():
|
| 23 |
+
result = runner.invoke(app)
|
| 24 |
+
assert result.exit_code == 0
|
| 25 |
+
assert "Running in production" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_demo():
|
| 29 |
+
result = runner.invoke(app, ["--demo"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Running demo" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_short_demo():
|
| 35 |
+
result = runner.invoke(app, ["-d"])
|
| 36 |
+
assert result.exit_code == 0
|
| 37 |
+
assert "Running demo" in result.output
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def test_script():
|
| 41 |
+
result = subprocess.run(
|
| 42 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 43 |
+
capture_output=True,
|
| 44 |
+
encoding="utf-8",
|
| 45 |
+
)
|
| 46 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.bool import tutorial004_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "-d" in result.output
|
| 19 |
+
assert "--demo" in result.output
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def test_main():
|
| 23 |
+
result = runner.invoke(app)
|
| 24 |
+
assert result.exit_code == 0
|
| 25 |
+
assert "Running in production" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_demo():
|
| 29 |
+
result = runner.invoke(app, ["--demo"])
|
| 30 |
+
assert result.exit_code == 0
|
| 31 |
+
assert "Running demo" in result.output
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def test_short_demo():
|
| 35 |
+
result = runner.invoke(app, ["-d"])
|
| 36 |
+
assert result.exit_code == 0
|
| 37 |
+
assert "Running demo" in result.output
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def test_script():
|
| 41 |
+
result = subprocess.run(
|
| 42 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 43 |
+
capture_output=True,
|
| 44 |
+
encoding="utf-8",
|
| 45 |
+
)
|
| 46 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.custom_types import tutorial001 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def test_parse_custom_type():
|
| 21 |
+
result = runner.invoke(app, ["0", "--custom-opt", "1"])
|
| 22 |
+
assert "custom_arg is <CustomClass: value=00>" in result.output
|
| 23 |
+
assert "custom-opt is <CustomClass: value=11>" in result.output
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def test_parse_custom_type_with_default():
|
| 27 |
+
result = runner.invoke(app, ["0"])
|
| 28 |
+
assert "custom_arg is <CustomClass: value=00>" in result.output
|
| 29 |
+
assert "custom-opt is <CustomClass: value=FooFoo>" in result.output
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def test_script():
|
| 33 |
+
result = subprocess.run(
|
| 34 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 35 |
+
capture_output=True,
|
| 36 |
+
encoding="utf-8",
|
| 37 |
+
)
|
| 38 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.custom_types import tutorial001_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def test_parse_custom_type():
|
| 21 |
+
result = runner.invoke(app, ["0", "--custom-opt", "1"])
|
| 22 |
+
assert "custom_arg is <CustomClass: value=00>" in result.output
|
| 23 |
+
assert "custom-opt is <CustomClass: value=11>" in result.output
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def test_parse_custom_type_with_default():
|
| 27 |
+
result = runner.invoke(app, ["0"])
|
| 28 |
+
assert "custom_arg is <CustomClass: value=00>" in result.output
|
| 29 |
+
assert "custom-opt is <CustomClass: value=FooFoo>" in result.output
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def test_script():
|
| 33 |
+
result = subprocess.run(
|
| 34 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 35 |
+
capture_output=True,
|
| 36 |
+
encoding="utf-8",
|
| 37 |
+
)
|
| 38 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.custom_types import tutorial002 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def test_parse_custom_type():
|
| 21 |
+
result = runner.invoke(app, ["0", "--custom-opt", "1"])
|
| 22 |
+
assert "custom_arg is <CustomClass: value=000>" in result.output
|
| 23 |
+
assert "custom-opt is <CustomClass: value=111>" in result.output
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def test_parse_custom_type_with_default():
|
| 27 |
+
result = runner.invoke(app, ["0"])
|
| 28 |
+
assert "custom_arg is <CustomClass: value=000>" in result.output
|
| 29 |
+
assert "custom-opt is <CustomClass: value=FooFooFoo>" in result.output
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def test_script():
|
| 33 |
+
result = subprocess.run(
|
| 34 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 35 |
+
capture_output=True,
|
| 36 |
+
encoding="utf-8",
|
| 37 |
+
)
|
| 38 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.custom_types import tutorial002_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def test_parse_custom_type():
|
| 21 |
+
result = runner.invoke(app, ["0", "--custom-opt", "1"])
|
| 22 |
+
assert "custom_arg is <CustomClass: value=000>" in result.output
|
| 23 |
+
assert "custom-opt is <CustomClass: value=111>" in result.output
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def test_parse_custom_type_with_default():
|
| 27 |
+
result = runner.invoke(app, ["0"])
|
| 28 |
+
assert "custom_arg is <CustomClass: value=000>" in result.output
|
| 29 |
+
assert "custom-opt is <CustomClass: value=FooFooFoo>" in result.output
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def test_script():
|
| 33 |
+
result = subprocess.run(
|
| 34 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 35 |
+
capture_output=True,
|
| 36 |
+
encoding="utf-8",
|
| 37 |
+
)
|
| 38 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/__init__.py
ADDED
|
File without changes
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.datetime import tutorial001 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_help():
|
| 16 |
+
result = runner.invoke(app, ["--help"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_main():
|
| 22 |
+
result = runner.invoke(app, ["1956-01-31T10:00:00"])
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Interesting day to be born: 1956-01-31 10:00:00" in result.output
|
| 25 |
+
assert "Birth hour: 10" in result.output
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def test_invalid():
|
| 29 |
+
result = runner.invoke(app, ["july-19-1989"])
|
| 30 |
+
assert result.exit_code != 0
|
| 31 |
+
assert (
|
| 32 |
+
"Invalid value for 'BIRTH:[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]':"
|
| 33 |
+
in result.output
|
| 34 |
+
)
|
| 35 |
+
assert "'july-19-1989' does not match the formats" in result.output
|
| 36 |
+
assert "%Y-%m-%d" in result.output
|
| 37 |
+
assert "%Y-%m-%dT%H:%M:%S" in result.output
|
| 38 |
+
assert "%Y-%m-%d %H:%M:%S" in result.output
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def test_script():
|
| 42 |
+
result = subprocess.run(
|
| 43 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 44 |
+
capture_output=True,
|
| 45 |
+
encoding="utf-8",
|
| 46 |
+
)
|
| 47 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.datetime import tutorial002 as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_main():
|
| 16 |
+
result = runner.invoke(app, ["1969-10-29"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Launch will be at: 1969-10-29 00:00:00" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_usa_weird_date_format():
|
| 22 |
+
result = runner.invoke(app, ["10/29/1969"])
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Launch will be at: 1969-10-29 00:00:00" in result.output
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def test_script():
|
| 28 |
+
result = subprocess.run(
|
| 29 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 30 |
+
capture_output=True,
|
| 31 |
+
encoding="utf-8",
|
| 32 |
+
)
|
| 33 |
+
assert "Usage" in result.stdout
|
miniconda3/pkgs/typer-0.20.0-py313h06a4308_1/info/test/typer/tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
import typer
|
| 5 |
+
from typer.testing import CliRunner
|
| 6 |
+
|
| 7 |
+
from docs_src.parameter_types.datetime import tutorial002_an as mod
|
| 8 |
+
|
| 9 |
+
runner = CliRunner()
|
| 10 |
+
|
| 11 |
+
app = typer.Typer()
|
| 12 |
+
app.command()(mod.main)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def test_main():
|
| 16 |
+
result = runner.invoke(app, ["1969-10-29"])
|
| 17 |
+
assert result.exit_code == 0
|
| 18 |
+
assert "Launch will be at: 1969-10-29 00:00:00" in result.output
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def test_usa_weird_date_format():
|
| 22 |
+
result = runner.invoke(app, ["10/29/1969"])
|
| 23 |
+
assert result.exit_code == 0
|
| 24 |
+
assert "Launch will be at: 1969-10-29 00:00:00" in result.output
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def test_script():
|
| 28 |
+
result = subprocess.run(
|
| 29 |
+
[sys.executable, "-m", "coverage", "run", mod.__file__, "--help"],
|
| 30 |
+
capture_output=True,
|
| 31 |
+
encoding="utf-8",
|
| 32 |
+
)
|
| 33 |
+
assert "Usage" in result.stdout
|