File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change
1
+ import pathlib
2
+
3
+ from typer import main
4
+
5
+
6
+ def test_param_path_convertor () -> None :
7
+ assert main .param_path_convertor (None ) is None
8
+ assert main .param_path_convertor ("/foo" ) == pathlib .Path ("/foo" )
9
+ # check that expanduser has been called.
10
+ # If we start to run tests on windows, we will probably need to update this
11
+ assert main .param_path_convertor ("~/foo" ).to_posix ().startswith ("/" )
Original file line number Diff line number Diff line change @@ -446,7 +446,7 @@ def get_command_from_info(command_info: CommandInfo) -> click.Command:
446
446
447
447
def param_path_convertor (value : Optional [str ] = None ) -> Optional [Path ]:
448
448
if value is not None :
449
- return Path (value )
449
+ return Path (value ). expanduser ()
450
450
return None
451
451
452
452
You can’t perform that action at this time.
0 commit comments