Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(62758)

Unified Diff: Lib/test/test_shutil.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_selectors.py ('k') | Lib/test/test_slice.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_shutil.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_shutil.py Fri Feb 07 23:40:05 2014 +0200
@@ -385,8 +385,8 @@
self.assertEqual(src_link_stat.st_flags, dst_link_stat.st_flags)
# tell to follow but dst is not a link
shutil.copystat(src_link, dst, follow_symlinks=False)
- self.assertTrue(abs(os.stat(src).st_mtime - os.stat(dst).st_mtime) <
- 00000.1)
+ self.assertAlmostEqual(os.stat(src).st_mtime, os.stat(dst).st_mtime,
+ delta=0.1)
@unittest.skipUnless(hasattr(os, 'chflags') and
hasattr(errno, 'EOPNOTSUPP') and
@@ -1639,7 +1639,7 @@
shutil.copyfile('srcfile', 'destfile')
self.assertTrue(srcfile._entered)
- self.assertTrue(srcfile._exited_with[0] is OSError)
+ self.assertIs(srcfile._exited_with[0], OSError)
self.assertEqual(srcfile._exited_with[1].args,
('Cannot open "destfile"',))
@@ -1661,7 +1661,7 @@
self.assertTrue(srcfile._entered)
self.assertTrue(destfile._entered)
self.assertTrue(destfile._raised)
- self.assertTrue(srcfile._exited_with[0] is OSError)
+ self.assertIs(srcfile._exited_with[0], OSError)
self.assertEqual(srcfile._exited_with[1].args,
('Cannot close',))
@@ -1684,7 +1684,7 @@
self.assertTrue(srcfile._entered)
self.assertTrue(destfile._entered)
self.assertFalse(destfile._raised)
- self.assertTrue(srcfile._exited_with[0] is None)
+ self.assertIsNone(srcfile._exited_with[0])
self.assertTrue(srcfile._raised)
def test_move_dir_caseinsensitive(self):
« no previous file with comments | « Lib/test/test_selectors.py ('k') | Lib/test/test_slice.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+