Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca6befb

Browse files
committed
More assertions in test_unicode_file, to chase issue #13348.
1 parent a011e2b commit ca6befb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/test/test_unicode_file.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,30 @@ def _do_copyish(self, filename1, filename2):
5656
# Should be able to rename the file using either name.
5757
self.assertTrue(os.path.isfile(filename1)) # must exist.
5858
os.rename(filename1, filename2 + ".new")
59-
self.assertTrue(os.path.isfile(filename1+".new"))
59+
self.assertFalse(os.path.isfile(filename2))
60+
self.assertTrue(os.path.isfile(filename1 + '.new'))
6061
os.rename(filename1 + ".new", filename2)
62+
self.assertFalse(os.path.isfile(filename1 + '.new'))
6163
self.assertTrue(os.path.isfile(filename2))
6264

6365
shutil.copy(filename1, filename2 + ".new")
6466
os.unlink(filename1 + ".new") # remove using equiv name.
6567
# And a couple of moves, one using each name.
6668
shutil.move(filename1, filename2 + ".new")
67-
self.assertTrue(not os.path.exists(filename2))
69+
self.assertFalse(os.path.exists(filename2))
70+
self.assertTrue(os.path.exists(filename1 + '.new'))
6871
shutil.move(filename1 + ".new", filename2)
72+
self.assertFalse(os.path.exists(filename2 + '.new'))
6973
self.assertTrue(os.path.exists(filename1))
7074
# Note - due to the implementation of shutil.move,
7175
# it tries a rename first. This only fails on Windows when on
7276
# different file systems - and this test can't ensure that.
7377
# So we test the shutil.copy2 function, which is the thing most
7478
# likely to fail.
7579
shutil.copy2(filename1, filename2 + ".new")
80+
self.assertTrue(os.path.isfile(filename1 + '.new'))
7681
os.unlink(filename1 + ".new")
82+
self.assertFalse(os.path.exists(filename2 + '.new'))
7783

7884
def _do_directory(self, make_name, chdir_name):
7985
cwd = os.getcwdb()

0 commit comments

Comments
 (0)