Skip to content

Commit 053729d

Browse files
committed
Add tests for bytes (POSIX only) and path-like objects (both platforms)
1 parent 3663237 commit 053729d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Lib/test/test_ntpath.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,9 @@ def test_path_splitext(self):
946946
def test_path_splitdrive(self):
947947
self._check_function(self.path.splitdrive)
948948

949+
def test_path_splitroot(self):
950+
self._check_function(self.path.splitroot)
951+
949952
def test_path_basename(self):
950953
self._check_function(self.path.basename)
951954

Lib/test/test_posixpath.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ def test_splitroot(self):
134134
self.assertEqual(f('c:/a/b'), ('', '', 'c:/a/b'))
135135
self.assertEqual(f('\\/a/b'), ('', '', '\\/a/b'))
136136
self.assertEqual(f('\\a\\b'), ('', '', '\\a\\b'))
137+
# Byte paths are supported
138+
self.assertEqual(f(b''), (b'', b'', b''))
139+
self.assertEqual(f(b'a'), (b'', b'', b'a'))
140+
self.assertEqual(f(b'/a'), (b'', b'/', b'a'))
141+
self.assertEqual(f(b'//a'), (b'', b'//', b'a'))
142+
self.assertEqual(f(b'///a'), (b'', b'/', b'//a'))
137143

138144
def test_isabs(self):
139145
self.assertIs(posixpath.isabs(""), False)
@@ -772,6 +778,9 @@ def test_path_splitext(self):
772778
def test_path_splitdrive(self):
773779
self.assertPathEqual(self.path.splitdrive)
774780

781+
def test_path_splitroot(self):
782+
self.assertPathEqual(self.path.splitroot)
783+
775784
def test_path_basename(self):
776785
self.assertPathEqual(self.path.basename)
777786

0 commit comments

Comments
 (0)