mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
use assert[Not]In where appropriate
A patch from Dave Malcolm.
This commit is contained in:
parent
a69ba65fdc
commit
577473fe68
75 changed files with 471 additions and 454 deletions
|
|
@ -787,8 +787,8 @@ class HandlerTests(unittest.TestCase):
|
|||
r = MockResponse(200, "OK", {}, "")
|
||||
newreq = h.do_request_(req)
|
||||
if data is None: # GET
|
||||
self.assertTrue("Content-length" not in req.unredirected_hdrs)
|
||||
self.assertTrue("Content-type" not in req.unredirected_hdrs)
|
||||
self.assertNotIn("Content-length", req.unredirected_hdrs)
|
||||
self.assertNotIn("Content-type", req.unredirected_hdrs)
|
||||
else: # POST
|
||||
self.assertEqual(req.unredirected_hdrs["Content-length"], "0")
|
||||
self.assertEqual(req.unredirected_hdrs["Content-type"],
|
||||
|
|
@ -907,13 +907,13 @@ class HandlerTests(unittest.TestCase):
|
|||
# now it's a GET, there should not be headers regarding content
|
||||
# (possibly dragged from before being a POST)
|
||||
headers = [x.lower() for x in o.req.headers]
|
||||
self.assertTrue("content-length" not in headers)
|
||||
self.assertTrue("content-type" not in headers)
|
||||
self.assertNotIn("content-length", headers)
|
||||
self.assertNotIn("content-type", headers)
|
||||
|
||||
self.assertEqual(o.req.headers["Nonsense"],
|
||||
"viking=withhold")
|
||||
self.assertTrue("Spam" not in o.req.headers)
|
||||
self.assertTrue("Spam" not in o.req.unredirected_hdrs)
|
||||
self.assertNotIn("Spam", o.req.headers)
|
||||
self.assertNotIn("Spam", o.req.unredirected_hdrs)
|
||||
|
||||
# loop detection
|
||||
req = Request(from_url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue