@@ -15,12 +15,30 @@ def test_path_to_url_unix() -> None:
15
15
16
16
17
17
@pytest .mark .skipif ("sys.platform != 'win32'" )
18
- def test_path_to_url_win () -> None :
19
- assert path_to_url ("c:/tmp/file" ) == "file:///C:/tmp/file"
20
- assert path_to_url ("c:\\ tmp\\ file" ) == "file:///C:/tmp/file"
21
- assert path_to_url (r"\\unc\as\path" ) == "file://unc/as/path"
22
- path = os .path .join (os .getcwd (), "file" )
23
- assert path_to_url ("file" ) == "file:" + urllib .request .pathname2url (path )
18
+ @pytest .mark .parametrize (
19
+ "path, url" ,
20
+ [
21
+ pytest .param ("c:/tmp/file" , "file:///C:/tmp/file" , id = "posix-path" ),
22
+ pytest .param ("c:\\ tmp\\ file" , "file:///C:/tmp/file" , id = "nt-path" ),
23
+ pytest .param (
24
+ r"\\unc\as\path" ,
25
+ "file://unc/as/path" ,
26
+ marks = pytest .mark .skipif (
27
+ "sys.platform != 'win32' or "
28
+ "sys.version_info == (3, 13, 0, 'beta', 2)"
29
+ ),
30
+ id = "unc-path" ,
31
+ ),
32
+ ],
33
+ )
34
+ def test_path_to_url_win (path : str , url : str ) -> None :
35
+ assert path_to_url (path ) == url
36
+
37
+
38
+ @pytest .mark .skipif ("sys.platform != 'win32'" )
39
+ def test_relative_path_to_url_win () -> None :
40
+ resolved_path = os .path .join (os .getcwd (), "file" )
41
+ assert path_to_url ("file" ) == "file:" + urllib .request .pathname2url (resolved_path )
24
42
25
43
26
44
@pytest .mark .parametrize (
0 commit comments