From d60e92a48d1e4d2298200e688329eda7a326be4a Mon Sep 17 00:00:00 2001 From: Johannes Gijsbers Date: Sat, 11 Sep 2004 21:26:21 +0000 Subject: Document not-completely-obvious behavior in a test. --- Lib/test/test_shutil.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index 9e5f6ff..f8367a6 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -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: -- cgit v0.12