diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-08-08 16:16:07 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-08-08 16:16:07 (GMT) |
commit | 419e384601c6af03feddace9c0254e7f3920b141 (patch) | |
tree | 188283fdd726f6559125812b4c55bb29d15120ea /Lib/test/test_urllib2_localnet.py | |
parent | 1f594ad424311fc3fb558a9ddfb126c5c9a0287e (diff) | |
download | cpython-419e384601c6af03feddace9c0254e7f3920b141.zip cpython-419e384601c6af03feddace9c0254e7f3920b141.tar.gz cpython-419e384601c6af03feddace9c0254e7f3920b141.tar.bz2 |
Use unittest specific methods for some urllib test cases. And replace urllib2 with urllib.request in comments.
Diffstat (limited to 'Lib/test/test_urllib2_localnet.py')
-rw-r--r-- | Lib/test/test_urllib2_localnet.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py index 4489356..b478996 100644 --- a/Lib/test/test_urllib2_localnet.py +++ b/Lib/test/test_urllib2_localnet.py @@ -172,7 +172,7 @@ class DigestAuthHandler: auth_validated = False # MSIE uses short_path in its validation, but Python's - # urllib2 uses the full path, so we're going to see if + # urllib.request uses the full path, so we're going to see if # either of them works here. for path in [request_handler.path, request_handler.short_path]: @@ -340,7 +340,7 @@ def GetRequestHandler(responses): class TestUrlopen(BaseTestCase): - """Tests urllib2.urlopen using the network. + """Tests urllib.request.urlopen using the network. These tests are not exhaustive. Assuming that testing using files does a good job overall of some of the basic interface features. There are no @@ -392,8 +392,8 @@ class TestUrlopen(BaseTestCase): handler = self.start_server(responses) data = self.urlopen("http://localhost:%s/" % handler.port) - self.assertEquals(data, expected_response) - self.assertEquals(handler.requests, ["/", "/somewhere_else"]) + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ["/", "/somewhere_else"]) def test_chunked(self): expected_response = b"hello world" @@ -407,7 +407,7 @@ class TestUrlopen(BaseTestCase): response = [(200, [("Transfer-Encoding", "chunked")], chunked_start)] handler = self.start_server(response) data = self.urlopen("http://localhost:%s/" % handler.port) - self.assertEquals(data, expected_response) + self.assertEqual(data, expected_response) def test_404(self): expected_response = b"Bad bad bad..." @@ -421,23 +421,23 @@ class TestUrlopen(BaseTestCase): else: self.fail("404 should raise URLError") - self.assertEquals(data, expected_response) - self.assertEquals(handler.requests, ["/weeble"]) + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ["/weeble"]) def test_200(self): expected_response = b"pycon 2008..." handler = self.start_server([(200, [], expected_response)]) data = self.urlopen("http://localhost:%s/bizarre" % handler.port) - self.assertEquals(data, expected_response) - self.assertEquals(handler.requests, ["/bizarre"]) + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ["/bizarre"]) def test_200_with_parameters(self): expected_response = b"pycon 2008..." handler = self.start_server([(200, [], expected_response)]) data = self.urlopen("http://localhost:%s/bizarre" % handler.port, b"get=with_feeling") - self.assertEquals(data, expected_response) - self.assertEquals(handler.requests, ["/bizarre", b"get=with_feeling"]) + self.assertEqual(data, expected_response) + self.assertEqual(handler.requests, ["/bizarre", b"get=with_feeling"]) def test_sending_headers(self): handler = self.start_server() |