mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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 ........
This commit is contained in:
parent
f41d29a8eb
commit
e96159335f
52 changed files with 287 additions and 288 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue