mirror of
https://github.com/python/cpython.git
synced 2025-12-10 19:10:59 +00:00
Document not-completely-obvious behavior in a test.
This commit is contained in:
parent
6ab4b99f95
commit
d60e92a48d
1 changed files with 7 additions and 0 deletions
|
|
@ -16,6 +16,13 @@ class TestShutil(unittest.TestCase):
|
||||||
self.assertEqual(shutil.rmtree(filename, True), None)
|
self.assertEqual(shutil.rmtree(filename, True), None)
|
||||||
shutil.rmtree(filename, False, lambda func, arg, exc: None)
|
shutil.rmtree(filename, False, lambda func, arg, exc: None)
|
||||||
|
|
||||||
|
def test_rmtree_dont_delete_file(self):
|
||||||
|
# When called on a file instead of a directory, don't delete it.
|
||||||
|
handle, path = tempfile.mkstemp()
|
||||||
|
os.fdopen(handle).close()
|
||||||
|
self.assertRaises(OSError, shutil.rmtree, path)
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
def test_dont_move_dir_in_itself(self):
|
def test_dont_move_dir_in_itself(self):
|
||||||
src_dir = tempfile.mkdtemp()
|
src_dir = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue