Issue #20555: Use specific asserts in urllib, httplib, ftplib, cgi, wsgiref tests.
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index eac9950..39a0132 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -591,8 +591,8 @@
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 sanepathname2url(path):
@@ -924,7 +924,8 @@
MockHeaders({"location": to_url}))
except urllib2.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")