Document not-completely-obvious behavior in a test.

This commit is contained in:
Johannes Gijsbers 2004-09-11 21:26:21 +00:00
parent 6ab4b99f95
commit d60e92a48d

View file

@ -16,6 +16,13 @@ class TestShutil(unittest.TestCase):
self.assertEqual(shutil.rmtree(filename, True), 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):
src_dir = tempfile.mkdtemp()
try: