diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-01-24 19:26:24 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-01-24 19:26:24 (GMT) |
commit | e96159335f6bb26615b57f880bf90440ed0123e4 (patch) | |
tree | 273325221fdef15629ebc63287c4772a3af40879 /Lib/test/test_urllib.py | |
parent | f41d29a8ebc27aafc18b6850648f1faa918e0e5d (diff) | |
download | cpython-e96159335f6bb26615b57f880bf90440ed0123e4.zip cpython-e96159335f6bb26615b57f880bf90440ed0123e4.tar.gz cpython-e96159335f6bb26615b57f880bf90440ed0123e4.tar.bz2 |
Merged revisions 77727 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77727 | ezio.melotti | 2010-01-24 18:58:36 +0200 (Sun, 24 Jan 2010) | 1 line
use assert[Not]IsInstance where appropriate
........
Diffstat (limited to 'Lib/test/test_urllib.py')
-rw-r--r-- | Lib/test/test_urllib.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 1f18190..02d08d4 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -85,8 +85,7 @@ class urlopen_FileTests(unittest.TestCase): def test_fileno(self): file_num = self.returned_obj.fileno() - self.assertTrue(isinstance(file_num, int), - "fileno() did not return an int") + self.assertIsInstance(file_num, int, "fileno() did not return an int") self.assertEqual(os.read(file_num, len(self.text)), self.text, "Reading on the file descriptor returned by fileno() " "did not return the expected text") @@ -97,7 +96,7 @@ class urlopen_FileTests(unittest.TestCase): self.returned_obj.close() def test_info(self): - self.assertTrue(isinstance(self.returned_obj.info(), email.message.Message)) + self.assertIsInstance(self.returned_obj.info(), email.message.Message) def test_geturl(self): self.assertEqual(self.returned_obj.geturl(), self.pathname) @@ -250,9 +249,9 @@ class urlretrieve_FileTests(unittest.TestCase): # a headers value is returned. result = urllib.request.urlretrieve("file:%s" % support.TESTFN) self.assertEqual(result[0], support.TESTFN) - self.assertTrue(isinstance(result[1], email.message.Message), - "did not get a email.message.Message instance as second " - "returned value") + self.assertIsInstance(result[1], email.message.Message, + "did not get a email.message.Message instance " + "as second returned value") def test_copy(self): # Test that setting the filename argument works. @@ -275,9 +274,9 @@ class urlretrieve_FileTests(unittest.TestCase): def test_reporthook(self): # Make sure that the reporthook works. def hooktester(count, block_size, total_size, count_holder=[0]): - self.assertTrue(isinstance(count, int)) - self.assertTrue(isinstance(block_size, int)) - self.assertTrue(isinstance(total_size, int)) + self.assertIsInstance(count, int) + self.assertIsInstance(block_size, int) + self.assertIsInstance(total_size, int) self.assertEqual(count, count_holder[0]) count_holder[0] = count_holder[0] + 1 second_temp = "%s.2" % support.TESTFN |