summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllibnet.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-06-30 23:06:06 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-06-30 23:06:06 (GMT)
commitc9c0f201fed21efcf669dbbf5f923eaf0eeb1db9 (patch)
tree6350dab0b481e6de307dc4e043c6230f463a9ca7 /Lib/test/test_urllibnet.py
parent98d23f2e065713ccfbc07d9a0b65f737a212bfb5 (diff)
downloadcpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.zip
cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.tar.gz
cpython-c9c0f201fed21efcf669dbbf5f923eaf0eeb1db9.tar.bz2
convert old fail* assertions to assert*
Diffstat (limited to 'Lib/test/test_urllibnet.py')
-rw-r--r--Lib/test/test_urllibnet.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_urllibnet.py b/Lib/test/test_urllibnet.py
index e2c8af3..63e061a 100644
--- a/Lib/test/test_urllibnet.py
+++ b/Lib/test/test_urllibnet.py
@@ -62,10 +62,10 @@ class urlopenNetworkTests(unittest.TestCase):
open_url = self.urlopen("http://www.python.org/")
for attr in ("read", "readline", "readlines", "fileno", "close",
"info", "geturl"):
- self.assert_(hasattr(open_url, attr), "object returned from "
+ self.assertTrue(hasattr(open_url, attr), "object returned from "
"urlopen lacks the %s attribute" % attr)
try:
- self.assert_(open_url.read(), "calling 'read' failed")
+ self.assertTrue(open_url.read(), "calling 'read' failed")
finally:
open_url.close()
@@ -73,9 +73,9 @@ class urlopenNetworkTests(unittest.TestCase):
# Test both readline and readlines.
open_url = self.urlopen("http://www.python.org/")
try:
- self.assert_(isinstance(open_url.readline(), bytes),
+ self.assertTrue(isinstance(open_url.readline(), bytes),
"readline did not return bytes")
- self.assert_(isinstance(open_url.readlines(), list),
+ self.assertTrue(isinstance(open_url.readlines(), list),
"readlines did not return a list")
finally:
open_url.close()
@@ -87,7 +87,7 @@ class urlopenNetworkTests(unittest.TestCase):
info_obj = open_url.info()
finally:
open_url.close()
- self.assert_(isinstance(info_obj, email.message.Message),
+ self.assertTrue(isinstance(info_obj, email.message.Message),
"object returned by 'info' is not an instance of "
"email.message.Message")
self.assertEqual(info_obj.get_content_subtype(), "html")
@@ -122,7 +122,7 @@ class urlopenNetworkTests(unittest.TestCase):
fd = open_url.fileno()
FILE = os.fdopen(fd, encoding='utf-8')
try:
- self.assert_(FILE.read(), "reading from file created using fd "
+ self.assertTrue(FILE.read(), "reading from file created using fd "
"returned by fileno failed")
finally:
FILE.close()
@@ -150,11 +150,11 @@ class urlretrieveNetworkTests(unittest.TestCase):
def test_basic(self):
# Test basic functionality.
file_location,info = self.urlretrieve("http://www.python.org/")
- self.assert_(os.path.exists(file_location), "file location returned by"
+ self.assertTrue(os.path.exists(file_location), "file location returned by"
" urlretrieve is not a valid path")
FILE = open(file_location, encoding='utf-8')
try:
- self.assert_(FILE.read(), "reading from the file location returned"
+ self.assertTrue(FILE.read(), "reading from the file location returned"
" by urlretrieve failed")
finally:
FILE.close()
@@ -165,10 +165,10 @@ class urlretrieveNetworkTests(unittest.TestCase):
file_location,info = self.urlretrieve("http://www.python.org/",
support.TESTFN)
self.assertEqual(file_location, support.TESTFN)
- self.assert_(os.path.exists(file_location))
+ self.assertTrue(os.path.exists(file_location))
FILE = open(file_location, encoding='utf-8')
try:
- self.assert_(FILE.read(), "reading from temporary file failed")
+ self.assertTrue(FILE.read(), "reading from temporary file failed")
finally:
FILE.close()
os.unlink(file_location)
@@ -177,7 +177,7 @@ class urlretrieveNetworkTests(unittest.TestCase):
# Make sure header returned as 2nd value from urlretrieve is good.
file_location, header = self.urlretrieve("http://www.python.org/")
os.unlink(file_location)
- self.assert_(isinstance(header, email.message.Message),
+ self.assertTrue(isinstance(header, email.message.Message),
"header is not an instance of email.message.Message")