Coverage for docs_src/parameter_types/number/tutorial001_an.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-19 20:29 +0000

1import typer 1abcdefghi

2from typing_extensions import Annotated 1abcdefghi

3 

4app = typer.Typer() 1abcdefghi

5 

6 

7@app.command() 1abcdefghi

8def main( 1abcdefghi

9 id: Annotated[int, typer.Argument(min=0, max=1000)], 

10 age: Annotated[int, typer.Option(min=18)] = 20, 

11 score: Annotated[float, typer.Option(max=100)] = 0, 

12): 

13 print(f"ID is {id}") 1abcdefghi

14 print(f"--age is {age}") 1abcdefghi

15 print(f"--score is {score}") 1abcdefghi

16 

17 

18if __name__ == "__main__": 1abcdefghi

19 app() 1abcdefghi