[test:utils] Fix `sanitize_path` test for Python 3.11 on Windows

Authored by: bashonly
pull/13878/head
bashonly 3 weeks ago
parent 62e2a9c0d5
commit ee5f59fdf4
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

@ -249,11 +249,13 @@ class TestUtil(unittest.TestCase):
self.assertEqual(sanitize_path('abc.../def...'), 'abc..#\\def..#')
self.assertEqual(sanitize_path('C:\\abc:%(title)s.%(ext)s'), 'C:\\abc#%(title)s.%(ext)s')
# Check with nt._path_normpath if available
# If nt._path_normpath is available, test with os.path.normpath
try:
from nt import _path_normpath as nt_path_normpath
from nt import _path_normpath as _ # noqa: F401
except ImportError:
nt_path_normpath = None
else:
from os.path import normpath as nt_path_normpath
for test, expected in [
('C:\\', 'C:\\'),

Loading…
Cancel
Save