mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-112675: Move path joining tests into test_posixpath
and test_ntpath
(#112676)
In `test_pathlib`, the `check_drive_root_parts` test methods evaluated both joining and parsing/normalisation of paths. This dates from a time when pathlib implemented both functions itself, but nowadays path joining is done with `posixpath.join()` and `ntpath.join()`. This commit moves the joining-related test cases into `test_posixpath` and `test_ntpath`.
This commit is contained in:
parent
2c3906bc4b
commit
28b2b7407c
3 changed files with 95 additions and 105 deletions
|
@ -256,6 +256,7 @@ class TestNtpath(NtpathTestCase):
|
|||
tester('ntpath.join("a", "b", "c")', 'a\\b\\c')
|
||||
tester('ntpath.join("a\\", "b", "c")', 'a\\b\\c')
|
||||
tester('ntpath.join("a", "b\\", "c")', 'a\\b\\c')
|
||||
tester('ntpath.join("a", "b", "c\\")', 'a\\b\\c\\')
|
||||
tester('ntpath.join("a", "b", "\\c")', '\\c')
|
||||
tester('ntpath.join("d:\\", "\\pleep")', 'd:\\pleep')
|
||||
tester('ntpath.join("d:\\", "a", "b")', 'd:\\a\\b')
|
||||
|
@ -313,6 +314,16 @@ class TestNtpath(NtpathTestCase):
|
|||
tester("ntpath.join('\\\\computer\\', 'share')", '\\\\computer\\share')
|
||||
tester("ntpath.join('\\\\computer\\share\\', 'a')", '\\\\computer\\share\\a')
|
||||
tester("ntpath.join('\\\\computer\\share\\a\\', 'b')", '\\\\computer\\share\\a\\b')
|
||||
# Second part is anchored, so that the first part is ignored.
|
||||
tester("ntpath.join('a', 'Z:b', 'c')", 'Z:b\\c')
|
||||
tester("ntpath.join('a', 'Z:\\b', 'c')", 'Z:\\b\\c')
|
||||
tester("ntpath.join('a', '\\\\b\\c', 'd')", '\\\\b\\c\\d')
|
||||
# Second part has a root but not drive.
|
||||
tester("ntpath.join('a', '\\b', 'c')", '\\b\\c')
|
||||
tester("ntpath.join('Z:/a', '/b', 'c')", 'Z:\\b\\c')
|
||||
tester("ntpath.join('//?/Z:/a', '/b', 'c')", '\\\\?\\Z:\\b\\c')
|
||||
tester("ntpath.join('D:a', './c:b')", 'D:a\\.\\c:b')
|
||||
tester("ntpath.join('D:/a', './c:b')", 'D:\\a\\.\\c:b')
|
||||
|
||||
def test_normpath(self):
|
||||
tester("ntpath.normpath('A//////././//.//B')", r'A\B')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue