mirror of
https://github.com/python/cpython.git
synced 2025-10-26 11:14:33 +00:00
GH-130608: Remove dirs_exist_ok argument from pathlib.Path.copy() (#130610)
This feature isn't sufficiently motivated.
This commit is contained in:
parent
fdcbc29f26
commit
b545450961
6 changed files with 13 additions and 40 deletions
|
|
@ -1495,23 +1495,6 @@ def test_copy_dir_to_existing_directory(self):
|
|||
target.joinpath('dirD').mkdir()
|
||||
self.assertRaises(FileExistsError, source.copy, target)
|
||||
|
||||
def test_copy_dir_to_existing_directory_dirs_exist_ok(self):
|
||||
base = self.cls(self.base)
|
||||
source = base / 'dirC'
|
||||
target = base / 'copyC'
|
||||
target.mkdir()
|
||||
target.joinpath('dirD').mkdir()
|
||||
result = source.copy(target, dirs_exist_ok=True)
|
||||
self.assertEqual(result, target)
|
||||
self.assertTrue(result.info.is_dir())
|
||||
self.assertTrue(result.joinpath('dirD').info.is_dir())
|
||||
self.assertTrue(result.joinpath('dirD', 'fileD').info.is_file())
|
||||
self.assertEqual(result.joinpath('dirD', 'fileD').read_text(),
|
||||
"this is file D\n")
|
||||
self.assertTrue(result.joinpath('fileC').info.is_file())
|
||||
self.assertTrue(result.joinpath('fileC').read_text(),
|
||||
"this is file C\n")
|
||||
|
||||
def test_copy_dir_to_itself(self):
|
||||
base = self.cls(self.base)
|
||||
source = base / 'dirC'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue