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

10 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-09-09 18:26 +0000

1from enum import Enum 1abcdefgh

2from typing import List 1abcdefgh

3 

4import typer 1abcdefgh

5from typing_extensions import Annotated 1abcdefgh

6 

7 

8class Food(str, Enum): 1abcdefgh

9 food_1 = "Eggs" 1abcdefgh

10 food_2 = "Bacon" 1abcdefgh

11 food_3 = "Cheese" 1abcdefgh

12 

13 

14def main(groceries: Annotated[List[Food], typer.Option()] = [Food.food_1, Food.food_3]): 1abcdefgh

15 print(f"Buying groceries: {', '.join([f.value for f in groceries])}") 1abcdefgh

16 

17 

18if __name__ == "__main__": 1abcdefgh

19 typer.run(main) 1abcdefgh