mirror of
https://github.com/python/cpython.git
synced 2025-09-01 14:38:00 +00:00
GH-130614: pathlib ABCs: revise test suite for readable paths (#131018)
Test `pathlib.types._ReadablePath` in a dedicated test module. These tests cover `ReadableZipPath`, `ReadableLocalPath` and `Path`, where the former two classes are implementations of `_ReadablePath` for use in tests.
This commit is contained in:
parent
24070492cf
commit
ad90c5fabc
5 changed files with 759 additions and 268 deletions
|
@ -2429,6 +2429,33 @@ class PathTest(test_pathlib_abc.RWPathTest, PurePathTest):
|
|||
with self.assertRaises(pathlib.UnsupportedOperation):
|
||||
q.symlink_to(p)
|
||||
|
||||
def test_info_exists_caching(self):
|
||||
p = self.cls(self.base)
|
||||
q = p / 'myfile'
|
||||
self.assertFalse(q.info.exists())
|
||||
self.assertFalse(q.info.exists(follow_symlinks=False))
|
||||
q.write_text('hullo')
|
||||
self.assertFalse(q.info.exists())
|
||||
self.assertFalse(q.info.exists(follow_symlinks=False))
|
||||
|
||||
def test_info_is_dir_caching(self):
|
||||
p = self.cls(self.base)
|
||||
q = p / 'mydir'
|
||||
self.assertFalse(q.info.is_dir())
|
||||
self.assertFalse(q.info.is_dir(follow_symlinks=False))
|
||||
q.mkdir()
|
||||
self.assertFalse(q.info.is_dir())
|
||||
self.assertFalse(q.info.is_dir(follow_symlinks=False))
|
||||
|
||||
def test_info_is_file_caching(self):
|
||||
p = self.cls(self.base)
|
||||
q = p / 'myfile'
|
||||
self.assertFalse(q.info.is_file())
|
||||
self.assertFalse(q.info.is_file(follow_symlinks=False))
|
||||
q.write_text('hullo')
|
||||
self.assertFalse(q.info.is_file())
|
||||
self.assertFalse(q.info.is_file(follow_symlinks=False))
|
||||
|
||||
@needs_symlinks
|
||||
def test_info_is_symlink_caching(self):
|
||||
p = self.cls(self.base)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue