Coverage for docs_src / parameter_types / enum / tutorial003_non_an.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-11-18 11:12 +0000

1from enum import StrEnum 1abcdefghij

2 

3import typer 1abcdefghij

4 

5 

6class Food(StrEnum): 1abcdefghij

7 food_1 = "Eggs" 1abcdefghij

8 food_2 = "Bacon" 1abcdefghij

9 food_3 = "Cheese" 1abcdefghij

10 

11 

12app = typer.Typer() 1abcdefghij

13 

14 

15@app.command() 1abcdefghij

16def main(groceries: list[Food] = typer.Option([Food.food_1, Food.food_3])): 1abcdefghij

17 print(f"Buying groceries: {', '.join(groceries)}") 1abcdefghij

18 

19 

20if __name__ == "__main__": 1abcdefghij

21 app() 1abcdefghij