88import posixpath
99import shlex
1010import sys
11- import unittest
1211
1312import pytest
1413
@@ -117,12 +116,16 @@ def test_fix_path(path, expected):
117116 ("spam.py" , ntpath , r".\spam.py" ),
118117 (r"eggs\spam.py" , ntpath , r".\eggs\spam.py" ),
119118 ("eggs\\ spam\\ " , ntpath , ".\\ eggs\\ spam\\ " ),
120- ("/spam.py" , ntpath , r"\spam.py" ), # Note the fixed "/".
119+ (
120+ "/spam.py" ,
121+ ntpath ,
122+ r".\\spam.py" if is_python313_or_later () else r"\spam.py" ,
123+ ), # Note the fixed "/".
121124 # absolute
122125 ("/" , posixpath , "/" ),
123126 ("/spam.py" , posixpath , "/spam.py" ),
124- ("\\ " , ntpath , "\\ " ),
125- (r"\spam.py" , ntpath , r"\spam.py" ),
127+ ("\\ " , ntpath , ". \\ " if is_python313_or_later () else " \\ " ),
128+ (r"\spam.py" , ntpath , r".\\spam.py" if is_python313_or_later () else r" \spam.py" ),
126129 (r"C:\spam.py" , ntpath , r"C:\spam.py" ),
127130 # no-op
128131 ("./spam.py" , posixpath , "./spam.py" ),
@@ -165,9 +168,9 @@ def test_fix_relpath(path, os_path, expected):
165168 ("eggs/spam.py" , ntpath , "./eggs/spam.py" ),
166169 ("eggs/spam/" , ntpath , "./eggs/spam/" ),
167170 # absolute (no-op)
168- ("/" , ntpath , "/" ),
171+ ("/" , ntpath , ".//" if is_python313_or_later () else " /" ),
169172 ("//" , ntpath , "//" ),
170- ("/spam.py" , ntpath , "/spam.py" ),
173+ ("/spam.py" , ntpath , ".//spam.py" if is_python313_or_later () else " /spam.py" ),
171174 # no-op
172175 (None , ntpath , None ),
173176 ("" , ntpath , "" ),
@@ -177,9 +180,9 @@ def test_fix_relpath(path, os_path, expected):
177180 ("eggs\\ spam\\ " , ntpath , "./eggs/spam/" ),
178181 (r".\spam.py" , ntpath , r"./spam.py" ),
179182 # absolute
180- (r"\spam.py" , ntpath , "/spam.py" ),
183+ (r"\spam.py" , ntpath , ".//spam.py" if is_python313_or_later () else " /spam.py" ),
181184 (r"C:\spam.py" , ntpath , "C:/spam.py" ),
182- ("\\ " , ntpath , "/" ),
185+ ("\\ " , ntpath , ".//" if is_python313_or_later () else " /" ),
183186 ("\\ \\ " , ntpath , "//" ),
184187 ("C:\\ \\ " , ntpath , "C://" ),
185188 ("C:/" , ntpath , "C:/" ),
0 commit comments