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

Side by Side Diff: Lib/test/test_file.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 7 years, 4 months ago
Left:
Right:
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 unified diff | Download patch
« no previous file with comments | « Lib/test/test_fileio.py ('k') | Lib/test/test_fnmatch.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import sys 1 import sys
2 import os 2 import os
3 import unittest 3 import unittest
4 from array import array 4 from array import array
5 from weakref import proxy 5 from weakref import proxy
6 6
7 import io 7 import io
8 import _pyio as pyio 8 import _pyio as pyio
9 9
10 from test.support import TESTFN, run_unittest 10 from test.support import TESTFN, run_unittest
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 # verify writelines with non-string object 76 # verify writelines with non-string object
77 class NonString: 77 class NonString:
78 pass 78 pass
79 79
80 self.assertRaises(TypeError, self.f.writelines, 80 self.assertRaises(TypeError, self.f.writelines,
81 [NonString(), NonString()]) 81 [NonString(), NonString()])
82 82
83 def testErrors(self): 83 def testErrors(self):
84 f = self.f 84 f = self.f
85 self.assertEqual(f.name, TESTFN) 85 self.assertEqual(f.name, TESTFN)
86 self.assertTrue(not f.isatty()) 86 self.assertFalse(f.isatty())
87 self.assertTrue(not f.closed) 87 self.assertFalse(f.closed)
88 88
89 if hasattr(f, "readinto"): 89 if hasattr(f, "readinto"):
90 self.assertRaises((IOError, TypeError), f.readinto, "") 90 self.assertRaises((IOError, TypeError), f.readinto, "")
91 f.close() 91 f.close()
92 self.assertTrue(f.closed) 92 self.assertTrue(f.closed)
93 93
94 def testMethods(self): 94 def testMethods(self):
95 methods = [('fileno', ()), 95 methods = [('fileno', ()),
96 ('flush', ()), 96 ('flush', ()),
97 ('isatty', ()), 97 ('isatty', ()),
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 # So get rid of it no matter what. 334 # So get rid of it no matter what.
335 try: 335 try:
336 run_unittest(CAutoFileTests, PyAutoFileTests, 336 run_unittest(CAutoFileTests, PyAutoFileTests,
337 COtherFileTests, PyOtherFileTests) 337 COtherFileTests, PyOtherFileTests)
338 finally: 338 finally:
339 if os.path.exists(TESTFN): 339 if os.path.exists(TESTFN):
340 os.unlink(TESTFN) 340 os.unlink(TESTFN)
341 341
342 if __name__ == '__main__': 342 if __name__ == '__main__':
343 test_main() 343 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_fileio.py ('k') | Lib/test/test_fnmatch.py » ('j') | no next file with comments »

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