mirror of
https://github.com/python/cpython.git
synced 2025-10-30 13:11:29 +00:00
GH-130614: pathlib ABCs: revise test suite for Posix path joining (#131017)
Test Posix-flavoured `pathlib.types._JoinablePath` in a dedicated test module. These tests cover `LexicalPosixPath`, `PurePosixPath` and `PosixPath`, where `LexicalPosixPath` is a simple implementation of `_JoinablePath` for use in tests.
This commit is contained in:
parent
93fc3d34f9
commit
5a484714c3
3 changed files with 55 additions and 23 deletions
|
|
@ -108,17 +108,6 @@ def test_str_subclass_windows(self):
|
|||
self._check_str_subclass('\\\\some\\share\\a')
|
||||
self._check_str_subclass('\\\\some\\share\\a\\b.txt')
|
||||
|
||||
@needs_posix
|
||||
def test_join_posix(self):
|
||||
P = self.cls
|
||||
p = P('//a')
|
||||
pp = p.joinpath('b')
|
||||
self.assertEqual(pp, P('//a/b'))
|
||||
pp = P('/a').joinpath('//c')
|
||||
self.assertEqual(pp, P('//c'))
|
||||
pp = P('//a').joinpath('/c')
|
||||
self.assertEqual(pp, P('/c'))
|
||||
|
||||
@needs_windows
|
||||
def test_join_windows(self):
|
||||
P = self.cls
|
||||
|
|
@ -157,18 +146,6 @@ def test_join_windows(self):
|
|||
pp = P('//./BootPartition').joinpath('Windows')
|
||||
self.assertEqual(pp, P('//./BootPartition/Windows'))
|
||||
|
||||
@needs_posix
|
||||
def test_div_posix(self):
|
||||
# Basically the same as joinpath().
|
||||
P = self.cls
|
||||
p = P('//a')
|
||||
pp = p / 'b'
|
||||
self.assertEqual(pp, P('//a/b'))
|
||||
pp = P('/a') / '//c'
|
||||
self.assertEqual(pp, P('//c'))
|
||||
pp = P('//a') / '/c'
|
||||
self.assertEqual(pp, P('/c'))
|
||||
|
||||
@needs_windows
|
||||
def test_div_windows(self):
|
||||
# Basically the same as joinpath().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue