diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-08 12:50:08 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-02-08 12:50:08 (GMT) |
| commit | 25d8aeac7c1e24df79c18f6391b7e42b873d66d8 (patch) | |
| tree | 3171eaac6be60dd8623e5d0ccab67adf38a44215 /Lib/test/test_urllib2.py | |
| parent | 3a20a5deade014a4559a71962600b23ee9f608f4 (diff) | |
| download | cpython-25d8aeac7c1e24df79c18f6391b7e42b873d66d8.zip cpython-25d8aeac7c1e24df79c18f6391b7e42b873d66d8.tar.gz cpython-25d8aeac7c1e24df79c18f6391b7e42b873d66d8.tar.bz2 | |
Issue #20555: Use specific asserts in urllib, httplib, ftplib, cgi, wsgiref tests.
Diffstat (limited to 'Lib/test/test_urllib2.py')
| -rw-r--r-- | Lib/test/test_urllib2.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index d4c8945..3559b1b 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -594,8 +594,8 @@ class OpenerDirectorTests(unittest.TestCase): self.assertIsInstance(args[0], Request) # response from opener.open is None, because there's no # handler that defines http_open to handle it - self.assertTrue(args[1] is None or - isinstance(args[1], MockResponse)) + if args[1] is not None: + self.assertIsInstance(args[1], MockResponse) def test_method_deprecations(self): req = Request("http://www.example.com") @@ -1000,7 +1000,8 @@ class HandlerTests(unittest.TestCase): MockHeaders({"location": to_url})) except urllib.error.HTTPError: # 307 in response to POST requires user OK - self.assertTrue(code == 307 and data is not None) + self.assertEqual(code, 307) + self.assertIsNotNone(data) self.assertEqual(o.req.get_full_url(), to_url) try: self.assertEqual(o.req.get_method(), "GET") |
