✅ Update tests to use `mod.app` (#1427)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sofie Van Landeghem · committed by GitHub · parent 69c8be6 · Browse files · 127 files·+132 added−474 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diff stats
127 files+132 added−474 removed
- tests:+129 added−471 removed
- other:+3 added−3 removed
Provenance
- Commit
f7b240d- Tree
e3bd258- Author
Sofie Van Landeghem <svlandeg@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
69c8be6
127 files changed+132 added−474 removed
modified:docs/tutorial/arguments/default.md+1 added-1 removed
50 unmodified lines5152535455555657585943 unmodified lines50 unmodified lines## Dynamic default value
And we can even make the default value be dynamically generated by passing a function as the `default_factory` argument:
{* docs_src/arguments/default/tutorial002_an.py hl[10:11,14] *}{* docs_src/arguments/default/tutorial002_an.py hl[9:10,14] *}
In this case, we created the function `get_name` that will just return a random `str` each time.
And we pass it as the first function argument to `typer.Argument()`.43 unmodified linesmodified:docs_src/arguments/default/tutorial002_an.py+1 added-1 removed
4 unmodified lines5 6 app = typer.Typer()7 8 9-@app.command()9 def get_name():10 return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])11 12 13+@app.command()14 def main(name: Annotated[str, typer.Argument(default_factory=get_name)]):15 print(f"Hello {name}")16 17 2 unmodified linesmodified:docs_src/arguments/default/tutorial002.py+1 added-1 removed
3 unmodified lines4 5 app = typer.Typer()6 7 8-@app.command()8 def get_name():9 return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])10 11 12+@app.command()13 def main(name: str = typer.Argument(default_factory=get_name)):14 print(f"Hello {name}")15 16 2 unmodified linesmodified:tests/test_completion/test_completion_install.py+1 added-3 removed
3 unmodified lines4 from pathlib import Path5 from unittest import mock6 7 import shellingham8-import typer8 from typer.testing import CliRunner9 10 from docs_src.typer_app import tutorial001 as mod11 12 from ..utils import requires_completion_permission13 14 runner = CliRunner()16-app = typer.Typer()17-app.command()(mod.main)15+app = mod.app16 17 18 @requires_completion_permission19 def test_completion_install_no_shell():151 unmodified linesmodified:tests/test_completion/test_completion_show.py+1 added-3 removed
2 unmodified lines3 import sys4 from unittest import mock5 6 import shellingham7-import typer7 from typer.testing import CliRunner8 9 from docs_src.typer_app import tutorial001 as mod10 11 runner = CliRunner()13-app = typer.Typer()14-app.command()(mod.main)12+app = mod.app13 14 15 def test_completion_show_no_shell():16 result = subprocess.run(131 unmodified linesmodified:tests/test_tutorial/test_arguments/test_default/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.default import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output23 unmodified linesmodified:tests/test_tutorial/test_arguments/test_default/test_tutorial001.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.default import tutorial001 as mod7 8 runner = CliRunner()9 11-app = typer.Typer()12-app.command()(mod.main)10+app = mod.app11 12 13 def test_help():14 result = runner.invoke(app, ["--help"])25 unmodified linesmodified:tests/test_tutorial/test_arguments/test_default/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.default import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output25 unmodified linesmodified:tests/test_tutorial/test_arguments/test_default/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.default import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output25 unmodified linesmodified:tests/test_tutorial/test_arguments/test_envvar/test_tutorial001_an.py+1 added-2 removed
8 unmodified lines9 from docs_src.arguments.envvar import tutorial001_an as mod10 11 runner = CliRunner()12 13-app = typer.Typer()14-app.command()(mod.main)13+app = mod.app14 15 16 def test_help():17 result = runner.invoke(app, ["--help"])43 unmodified linesmodified:tests/test_tutorial/test_arguments/test_envvar/test_tutorial001.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.envvar import tutorial001 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "[OPTIONS] [NAME]" in result.output40 unmodified linesmodified:tests/test_tutorial/test_arguments/test_envvar/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.envvar import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output30 unmodified linesmodified:tests/test_tutorial/test_arguments/test_envvar/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.envvar import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output30 unmodified linesmodified:tests/test_tutorial/test_arguments/test_envvar/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.envvar import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output30 unmodified linesmodified:tests/test_tutorial/test_arguments/test_envvar/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.envvar import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output30 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial001_an.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.help import tutorial001_an as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "[OPTIONS] NAME" in result.output30 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial001.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.help import tutorial001 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "[OPTIONS] NAME" in result.output30 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] NAME" in result.output20 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] NAME" in result.output20 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output20 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output20 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial004_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial004_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output20 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial004.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial004 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output20 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial005_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial005_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output18 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial005.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial005 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output18 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial006_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial006_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] ✨username✨" in result.output18 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial006.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial006 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] ✨username✨" in result.output18 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial007_an.py+1 added-5 removed
1 import subprocess2 import sys3 4-import typer5-import typer.core4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial007_an as mod7 8 runner = CliRunner()9+app = mod.app10 12-app = typer.Typer()13-app.command()(mod.main)11 15-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "Say hi to NAME very gently, like Dirk." in result.output17 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial007.py+1 added-5 removed
1 import subprocess2 import sys3 4-import typer5-import typer.core4 from typer.testing import CliRunner5 6 from docs_src.arguments.help import tutorial007 as mod7 8 runner = CliRunner()9+app = mod.app10 12-app = typer.Typer()13-app.command()(mod.main)11 15-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "Say hi to NAME very gently, like Dirk." in result.output17 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial008_an.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.help import tutorial008_an as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "[OPTIONS] [NAME]" in result.output28 unmodified linesmodified:tests/test_tutorial/test_arguments/test_help/test_tutorial008.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.help import tutorial008 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "[OPTIONS] [NAME]" in result.output28 unmodified linesmodified:tests/test_tutorial/test_arguments/test_optional/test_tutorial001_an.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.optional import tutorial001_an as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_call_no_arg():16 result = runner.invoke(app)17 assert result.exit_code != 018 assert "Missing argument 'NAME'." in result.output29 unmodified linesmodified:tests/test_tutorial/test_arguments/test_optional/test_tutorial001.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.optional import tutorial001 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_call_no_arg():16 result = runner.invoke(app)17 assert result.exit_code != 018 assert "Missing argument 'NAME'." in result.output29 unmodified linesmodified:tests/test_tutorial/test_arguments/test_optional/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.optional import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output21 unmodified linesmodified:tests/test_tutorial/test_arguments/test_optional/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.arguments.optional import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[OPTIONS] [NAME]" in result.output21 unmodified linesmodified:tests/test_tutorial/test_arguments/test_optional/test_tutorial003.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.arguments.optional import tutorial003 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_call_no_arg():16 result = runner.invoke(app)17 assert result.exit_code != 018 assert "Missing argument 'NAME'." in result.output29 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial001.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.arguments_with_multiple_values import tutorial001 as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_main():13 result = runner.invoke(app, ["README.md", "pyproject.toml", "woohoo!"])12 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002_an.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.arguments_with_multiple_values import (7 tutorial002_an as mod,8 )9 10 runner = CliRunner()12-app = typer.Typer()13-app.command()(mod.main)11+app = mod.app12 13 14 def test_help():15 result = runner.invoke(app, ["--help"])35 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_arguments_with_multiple_values/test_tutorial002.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.arguments_with_multiple_values import tutorial002 as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_help():13 result = runner.invoke(app, ["--help"])35 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001_an.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.multiple_options import tutorial001_an as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_main():13 result = runner.invoke(app)29 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial001.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.multiple_options import tutorial001 as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_main():13 result = runner.invoke(app)29 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002_an.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.multiple_options import tutorial002_an as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_main():13 result = runner.invoke(app)23 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_multiple_options/test_tutorial002.py+2 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.multiple_options import tutorial002 as mod7 8+app = mod.app9+10 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)11 12 13 def test_main():14 result = runner.invoke(app)23 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001_an.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.options_with_multiple_values import tutorial001_an as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_main():13 result = runner.invoke(app)32 unmodified linesmodified:tests/test_tutorial/test_multiple_values/test_options_with_multiple_values/test_tutorial001.py+1 added-3 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.multiple_values.options_with_multiple_values import tutorial001 as mod7 8 runner = CliRunner()10-app = typer.Typer()11-app.command()(mod.main)9+app = mod.app10 11 12 def test_main():13 result = runner.invoke(app)32 unmodified linesmodified:tests/test_tutorial/test_options/test_callback/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.callback import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_1():13 result = runner.invoke(app, ["--name", "Camila"])14 assert result.exit_code == 015 assert "Hello Camila" in result.output16 unmodified linesmodified:tests/test_tutorial/test_options/test_callback/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.callback import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_1():13 result = runner.invoke(app, ["--name", "Camila"])14 assert result.exit_code == 015 assert "Hello Camila" in result.output16 unmodified linesmodified:tests/test_tutorial/test_options/test_callback/test_tutorial003_an.py+1 added-4 removed
1 import os2 import subprocess3 import sys4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.options.callback import tutorial003_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_1():14 result = runner.invoke(app, ["--name", "Camila"])15 assert result.exit_code == 016 assert "Validating name" in result.output32 unmodified linesmodified:tests/test_tutorial/test_options/test_callback/test_tutorial003.py+1 added-4 removed
1 import os2 import subprocess3 import sys4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.options.callback import tutorial003 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_1():14 result = runner.invoke(app, ["--name", "Camila"])15 assert result.exit_code == 016 assert "Validating name" in result.output32 unmodified linesmodified:tests/test_tutorial/test_options/test_callback/test_tutorial004_an.py+1 added-4 removed
1 import os2 import subprocess3 import sys4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.options.callback import tutorial004_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_1():14 result = runner.invoke(app, ["--name", "Camila"])15 assert result.exit_code == 016 assert "Validating param: name" in result.output32 unmodified linesmodified:tests/test_tutorial/test_options/test_callback/test_tutorial004.py+1 added-4 removed
1 import os2 import subprocess3 import sys4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.options.callback import tutorial004 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_1():14 result = runner.invoke(app, ["--name", "Camila"])15 assert result.exit_code == 016 assert "Validating param: name" in result.output32 unmodified linesmodified:tests/test_tutorial/test_options/test_help/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.help import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "Say hi to NAME, optionally with a --lastname." in result.output30 unmodified linesmodified:tests/test_tutorial/test_options/test_help/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.help import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "Say hi to NAME, optionally with a --lastname." in result.output30 unmodified linesmodified:tests/test_tutorial/test_options/test_help/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.help import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_call():13 result = runner.invoke(app, ["World"])14 assert result.exit_code == 015 assert "Hello World" in result.output26 unmodified linesmodified:tests/test_tutorial/test_options/test_help/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.help import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_call():13 result = runner.invoke(app, ["World"])14 assert result.exit_code == 015 assert "Hello World" in result.output26 unmodified linesmodified:tests/test_tutorial/test_options/test_help/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.help import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_call():13 result = runner.invoke(app)14 assert result.exit_code == 015 assert "Hello Wade Wilson" in result.output17 unmodified linesmodified:tests/test_tutorial/test_options/test_help/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.help import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_call():13 result = runner.invoke(app)14 assert result.exit_code == 015 assert "Hello Wade Wilson" in result.output17 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--name" in result.output23 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--name" in result.output23 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output18 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output18 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial004_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial004_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial004.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial004 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial005_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial005_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output36 unmodified linesmodified:tests/test_tutorial/test_options/test_name/test_tutorial005.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.name import tutorial005 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-n" in result.output36 unmodified linesmodified:tests/test_tutorial/test_options/test_prompt/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.prompt import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_lastname():13 result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])14 assert result.exit_code == 015 assert "Hello Camila Gutiérrez" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_prompt/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.prompt import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_lastname():13 result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])14 assert result.exit_code == 015 assert "Hello Camila Gutiérrez" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_prompt/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.prompt import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_lastname():13 result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])14 assert result.exit_code == 015 assert "Hello Camila Gutiérrez" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_prompt/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.prompt import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_option_lastname():13 result = runner.invoke(app, ["Camila", "--lastname", "Gutiérrez"])14 assert result.exit_code == 015 assert "Hello Camila Gutiérrez" in result.output24 unmodified linesmodified:tests/test_tutorial/test_options/test_prompt/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.prompt import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_prompt():13 result = runner.invoke(app, input="Old Project\nOld Project\n")14 assert result.exit_code == 015 assert "Deleting project Old Project" in result.output33 unmodified linesmodified:tests/test_tutorial/test_options/test_prompt/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.options.prompt import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_prompt():13 result = runner.invoke(app, input="Old Project\nOld Project\n")14 assert result.exit_code == 015 assert "Deleting project Old Project" in result.output33 unmodified linesmodified:tests/test_tutorial/test_options/test_required/test_tutorial001_an.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.options.required import tutorial001_an as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_1():16 result = runner.invoke(app, ["Camila"])17 assert result.exit_code != 018 assert "Missing option '--lastname'" in result.output32 unmodified linesmodified:tests/test_tutorial/test_options/test_required/test_tutorial001.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.options.required import tutorial001 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_1():16 result = runner.invoke(app, ["Camila"])17 assert result.exit_code != 018 assert "Missing option '--lastname'" in result.output32 unmodified linesmodified:tests/test_tutorial/test_options/test_version/test_tutorial003_an.py+1 added-4 removed
1 import os2 import subprocess3 import sys4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.options.version import tutorial003_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_1():14 result = runner.invoke(app, ["--name", "Rick", "--version"])15 assert result.exit_code == 016 assert "Awesome CLI Version: 0.1.0" in result.output37 unmodified linesmodified:tests/test_tutorial/test_options/test_version/test_tutorial003.py+1 added-4 removed
1 import os2 import subprocess3 import sys4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.options.version import tutorial003 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_1():14 result = runner.invoke(app, ["--name", "Rick", "--version"])15 assert result.exit_code == 016 assert "Awesome CLI Version: 0.1.0" in result.output37 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.bool import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--force" in result.output28 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.bool import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--force" in result.output28 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002_an.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.parameter_types.bool import tutorial002_an as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "--accept" in result.output44 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial002.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.parameter_types.bool import tutorial002 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "--accept" in result.output44 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.bool import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-f" in result.output24 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.bool import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-f" in result.output24 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.bool import tutorial004_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-d" in result.output28 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_bool/test_tutorial004.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.bool import tutorial004 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "-d" in result.output28 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.custom_types import tutorial001_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 20 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.custom_types import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 20 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.custom_types import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 20 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_custom_types/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.custom_types import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 20 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.datetime import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "[%Y-%m-%d|%Y-%m-%dT%H:%M:%S|%Y-%m-%d %H:%M:%S]" in result.output29 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.datetime import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_main():13 result = runner.invoke(app, ["1969-10-29"])14 assert result.exit_code == 015 assert "Launch will be at: 1969-10-29 00:00:00" in result.output15 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_datetime/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.datetime import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_main():13 result = runner.invoke(app, ["1969-10-29"])14 assert result.exit_code == 015 assert "Launch will be at: 1969-10-29 00:00:00" in result.output15 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--network" in result.output43 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_upper():13 result = runner.invoke(app, ["--network", "CONV"])14 assert result.exit_code == 015 assert "Training neural network of type: conv" in result.output15 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_upper():13 result = runner.invoke(app, ["--network", "CONV"])14 assert result.exit_code == 015 assert "Training neural network of type: conv" in result.output15 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--groceries" in result.output29 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--groceries" in result.output29 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial004_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial004_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--network [simple|conv|lstm]" in result.output.replace(" ", "")28 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_enum/test_tutorial004.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.enum import tutorial004 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--network [simple|conv|lstm]" in result.output.replace(" ", "")28 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial001_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 config_file.write_text("some settings\nsome more settings")16 result = runner.invoke(app, ["--config", f"{config_file}"])13 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial001 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 config_file.write_text("some settings\nsome more settings")16 result = runner.invoke(app, ["--config", f"{config_file}"])13 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial002_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 if config_file.exists(): # pragma: no cover16 config_file.unlink()15 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial002 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 if config_file.exists(): # pragma: no cover16 config_file.unlink()15 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial003_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 binary_file = Path(tmpdir) / "config.txt"15 binary_file.write_bytes(b"la cig\xc3\xbce\xc3\xb1a trae al ni\xc3\xb1o")16 result = runner.invoke(app, ["--file", f"{binary_file}"])12 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial003 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 binary_file = Path(tmpdir) / "config.txt"15 binary_file.write_bytes(b"la cig\xc3\xbce\xc3\xb1a trae al ni\xc3\xb1o")16 result = runner.invoke(app, ["--file", f"{binary_file}"])12 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial004_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial004_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 binary_file = Path(tmpdir) / "config.txt"15 if binary_file.exists(): # pragma: no cover16 binary_file.unlink()16 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial004.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial004 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 binary_file = Path(tmpdir) / "config.txt"15 if binary_file.exists(): # pragma: no cover16 binary_file.unlink()16 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial005_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial005_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 if config_file.exists(): # pragma: no cover16 config_file.unlink()18 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_file/test_tutorial005.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.file import tutorial005 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_main(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 if config_file.exists(): # pragma: no cover16 config_file.unlink()18 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_index/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.index import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_help():13 result = runner.invoke(app, ["--help"])14 assert result.exit_code == 015 assert "--age" in result.output30 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_number/test_tutorial001_an.py+3 added-4 removed
7 unmodified lines8 9 from docs_src.parameter_types.number import tutorial001_an as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer(rich_markup_mode=None)14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "--age" in result.output34 unmodified lines53 assert "Invalid value for '--age'" in result.output54 assert "15 is not in the range x>=18" in result.output55 56 59-def test_invalid_score():57+def test_invalid_score(monkeypatch: pytest.MonkeyPatch):58+ monkeypatch.setattr(typer.core, "HAS_RICH", False)59 result = runner.invoke(app, ["5", "--age", "20", "--score", "100.5"])60 assert result.exit_code != 061 assert "Invalid value for '--score'" in result.output62 assert "100.5 is not in the range x<=100." in result.output17 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_number/test_tutorial001.py+3 added-4 removed
7 unmodified lines8 9 from docs_src.parameter_types.number import tutorial001 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer(rich_markup_mode=None)14-app.command()(mod.main)14 16-15 def test_help():16 result = runner.invoke(app, ["--help"])17 assert result.exit_code == 018 assert "--age" in result.output34 unmodified lines53 assert "Invalid value for '--age'" in result.output54 assert "15 is not in the range x>=18" in result.output55 56 59-def test_invalid_score():57+def test_invalid_score(monkeypatch: pytest.MonkeyPatch):58+ monkeypatch.setattr(typer.core, "HAS_RICH", False)59 result = runner.invoke(app, ["5", "--age", "20", "--score", "100.5"])60 assert result.exit_code != 061 assert "Invalid value for '--score'" in result.output62 assert "100.5 is not in the range x<=100." in result.output17 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_number/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.number import tutorial002_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_invalid_id():13 result = runner.invoke(app, ["1002"])14 assert result.exit_code != 015 assert (19 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_number/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.number import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_invalid_id():13 result = runner.invoke(app, ["1002"])14 assert result.exit_code != 015 assert (19 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_number/test_tutorial003_an.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.number import tutorial003_an as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_main():13 result = runner.invoke(app)14 assert result.exit_code == 015 assert "Verbose level is 0" in result.output39 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_number/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.number import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_main():13 result = runner.invoke(app)14 assert result.exit_code == 015 assert "Verbose level is 0" in result.output39 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_path/test_tutorial001_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.path import tutorial001_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_no_path(tmpdir):14 Path(tmpdir) / "config.txt"15 result = runner.invoke(app)16 assert result.exit_code == 135 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_path/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.path import tutorial001 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_no_path(tmpdir):14 Path(tmpdir) / "config.txt"15 result = runner.invoke(app)16 assert result.exit_code == 135 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_path/test_tutorial002_an.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.path import tutorial002_an as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_not_exists(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 if config_file.exists(): # pragma: no cover16 config_file.unlink()30 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_path/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 from pathlib import Path4 5-import typer5 from typer.testing import CliRunner6 7 from docs_src.parameter_types.path import tutorial002 as mod8 9 runner = CliRunner()10+app = mod.app11 12-app = typer.Typer()13-app.command()(mod.main)12 15-13 def test_not_exists(tmpdir):14 config_file = Path(tmpdir) / "config.txt"15 if config_file.exists(): # pragma: no cover16 config_file.unlink()30 unmodified linesmodified:tests/test_tutorial/test_parameter_types/test_uuid/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.parameter_types.uuid import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_main():13 result = runner.invoke(app, ["d48edaa6-871a-4082-a196-4daab372d4a1"])14 assert result.exit_code == 015 assert "USER_ID is d48edaa6-871a-4082-a196-4daab372d4a1" in result.output19 unmodified linesmodified:tests/test_tutorial/test_prompt/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.prompt import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_cli():13 result = runner.invoke(app, input="Camila\n")14 assert result.exit_code == 015 assert "What's your name?:" in result.output10 unmodified linesmodified:tests/test_tutorial/test_prompt/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.prompt import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_cli():13 result = runner.invoke(app, input="y\n")14 assert result.exit_code == 015 assert "Are you sure you want to delete it? [y/N]:" in result.output18 unmodified linesmodified:tests/test_tutorial/test_prompt/test_tutorial003.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.prompt import tutorial003 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_cli():13 result = runner.invoke(app, input="y\n")14 assert result.exit_code == 015 assert "Are you sure you want to delete it? [y/N]:" in result.output17 unmodified linesmodified:tests/test_tutorial/test_terminating/test_tutorial001.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.terminating import tutorial001 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_cli():13 result = runner.invoke(app, ["Camila"])14 assert result.exit_code == 015 assert "User created: Camila" in result.output25 unmodified linesmodified:tests/test_tutorial/test_terminating/test_tutorial002.py+1 added-4 removed
1 import subprocess2 import sys3 4-import typer4 from typer.testing import CliRunner5 6 from docs_src.terminating import tutorial002 as mod7 8 runner = CliRunner()9+app = mod.app10 11-app = typer.Typer()12-app.command()(mod.main)11 14-12 def test_cli():13 result = runner.invoke(app, ["Camila"])14 assert result.exit_code == 015 assert "New user created: Camila" in result.output15 unmodified linesmodified:tests/test_tutorial/test_terminating/test_tutorial003.py+1 added-3 removed
7 unmodified lines8 9 from docs_src.terminating import tutorial003 as mod10 11 runner = CliRunner()12+app = mod.app13 13-app = typer.Typer()14-app.command()(mod.main)14 16-15 def test_cli():16 result = runner.invoke(app, ["Camila"])17 assert result.exit_code == 018 assert "New user created: Camila" in result.output31 unmodified lines