Coverage for docs_src / parameter_types / datetime / tutorial002.py: 100%

7 statements  

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

1from datetime import datetime 1abcdefghij

2from typing import Annotated 1abcdefghij

3 

4import typer 1abcdefghij

5 

6app = typer.Typer() 1abcdefghij

7 

8 

9@app.command() 1abcdefghij

10def main( 1abcdefghij

11 launch_date: Annotated[ 

12 datetime, 

13 typer.Argument(formats=["%Y-%m-%d", "%m/%d/%Y"]), 

14 ], 

15): 

16 print(f"Launch will be at: {launch_date}") 1abcdefghij

17 

18 

19if __name__ == "__main__": 1abcdefghij

20 app() 1abcdefghij