diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-06-11 18:40:13 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-06-11 18:40:13 (GMT) |
commit | 6ffface4293f20e504de6a7ca012c482a203409d (patch) | |
tree | 06d09d0290dfdaa7c0c990a060dc958710126cdc /Lib/test/test_shutil.py | |
parent | 6fe56a329dd427f2a5363b43ad24f04785d2091d (diff) | |
download | cpython-6ffface4293f20e504de6a7ca012c482a203409d.zip cpython-6ffface4293f20e504de6a7ca012c482a203409d.tar.gz cpython-6ffface4293f20e504de6a7ca012c482a203409d.tar.bz2 |
#19840: Add copy_function to shutil.move.
Patch by Claudiu Popa.
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index a483fe1..098d58e 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -1592,6 +1592,24 @@ class TestMove(unittest.TestCase): rv = shutil.move(self.src_file, os.path.join(self.dst_dir, 'bar')) self.assertEqual(rv, os.path.join(self.dst_dir, 'bar')) + @mock_rename + def test_move_file_special_function(self): + moved = [] + def _copy(src, dst): + moved.append((src, dst)) + shutil.move(self.src_file, self.dst_dir, copy_function=_copy) + self.assertEqual(len(moved), 1) + + @mock_rename + def test_move_dir_special_function(self): + moved = [] + def _copy(src, dst): + moved.append((src, dst)) + support.create_empty_file(os.path.join(self.src_dir, 'child')) + support.create_empty_file(os.path.join(self.src_dir, 'child1')) + shutil.move(self.src_dir, self.dst_dir, copy_function=_copy) + self.assertEqual(len(moved), 3) + class TestCopyFile(unittest.TestCase): |