Coverage for docs_src / parameter_types / enum / tutorial003.py: 100%
11 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-11-18 11:12 +0000
1from enum import StrEnum 1abcdefghij
2from typing import Annotated 1abcdefghij
4import typer 1abcdefghij
7class Food(StrEnum): 1abcdefghij
8 food_1 = "Eggs" 1abcdefghij
9 food_2 = "Bacon" 1abcdefghij
10 food_3 = "Cheese" 1abcdefghij
13app = typer.Typer() 1abcdefghij
16@app.command() 1abcdefghij
17def main(groceries: Annotated[list[Food], typer.Option()] = [Food.food_1, Food.food_3]): 1abcdefghij
18 print(f"Buying groceries: {', '.join(groceries)}") 1abcdefghij
21if __name__ == "__main__": 1abcdefghij
22 app() 1abcdefghij