Skip to content
Myr

test_types.py

This file

Path

tests/test_types.py

34 lines · 841 bytes · Python

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than c189348 point at it.

⬆ Bump ruff from 0.14.13 to 0.14.14 (#1499)dependabot[bot]before adoptionc189348

lines 1–34why, one step back
1from enum import Enum
23import typer4from typer.testing import CliRunner56app = typer.Typer(context_settings={"token_normalize_func": str.lower})789class User(str, Enum):10 rick = "Rick"11 morty = "Morty"121314@app.command()15def hello(name: User = User.rick) -> None:16 print(f"Hello {name.value}!")171819runner = CliRunner()202122def test_enum_choice() -> None:23 # This test is only for coverage of the new custom TyperChoice class24 result = runner.invoke(app, ["--name", "morty"], catch_exceptions=False)25 assert result.exit_code == 026 assert "Hello Morty!" in result.output2728 result = runner.invoke(app, ["--name", "Rick"])29 assert result.exit_code == 030 assert "Hello Rick!" in result.output3132 result = runner.invoke(app, ["--name", "RICK"])33 assert result.exit_code == 034 assert "Hello Rick!" in result.output