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

9 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

5 

6 

7class Food(str, Enum): 1abcdefgh

8 food_1 = "Eggs" 1abcdefgh

9 food_2 = "Bacon" 1abcdefgh

10 food_3 = "Cheese" 1abcdefgh

11 

12 

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

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

15 

16 

17if __name__ == "__main__": 1abcdefgh

18 typer.run(main) 1abcdefgh