summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_http_cookiejar.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-01-23 15:40:09 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-01-23 15:40:09 (GMT)
commitb58e0bd8bb7592dd48b30af546fc20f52ac625bd (patch)
tree2af0b7f4177890e1781f8d38aed8ebdc44c71f39 /Lib/test/test_http_cookiejar.py
parent0f77f465ff7f5e39bbf701b575aebf75dd8d800d (diff)
downloadcpython-b58e0bd8bb7592dd48b30af546fc20f52ac625bd.zip
cpython-b58e0bd8bb7592dd48b30af546fc20f52ac625bd.tar.gz
cpython-b58e0bd8bb7592dd48b30af546fc20f52ac625bd.tar.bz2
use assert[Not]In where appropriate
Diffstat (limited to 'Lib/test/test_http_cookiejar.py')
-rw-r--r--Lib/test/test_http_cookiejar.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/Lib/test/test_http_cookiejar.py b/Lib/test/test_http_cookiejar.py
index f244b2b..1c047b4 100644
--- a/Lib/test/test_http_cookiejar.py
+++ b/Lib/test/test_http_cookiejar.py
@@ -901,8 +901,7 @@ class CookieTests(TestCase):
url = "http://foo.bar.com/"
interact_2965(c, url, "spam=eggs; Version=1")
h = interact_2965(c, url)
- self.assertTrue("Path" not in h,
- "absent path returned with path present")
+ self.assertNotIn("Path", h, "absent path returned with path present")
c = CookieJar(pol)
url = "http://foo.bar.com/"
@@ -917,8 +916,7 @@ class CookieTests(TestCase):
url = "http://foo.bar.com/"
interact_2965(c, url, "spam=eggs; Version=1")
h = interact_2965(c, url)
- self.assertTrue("Port" not in h,
- "absent port returned with port present")
+ self.assertNotIn("Port", h, "absent port returned with port present")
c = CookieJar(pol)
url = "http://foo.bar.com/"
@@ -931,16 +929,16 @@ class CookieTests(TestCase):
url = "http://foo.bar.com/"
interact_2965(c, url, 'spam=eggs; Version=1; Port="80"')
h = interact_2965(c, url)
- self.assertTrue('$Port="80"' in h,
- "port with single value not returned with single value")
+ self.assertIn('$Port="80"', h,
+ "port with single value not returned with single value")
c = CookieJar(pol)
url = "http://foo.bar.com/"
interact_2965(c, url, 'spam=eggs; Version=1; Port="80,8080"')
h = interact_2965(c, url)
- self.assertTrue('$Port="80,8080"' in h,
- "port with multiple values not returned with multiple "
- "values")
+ self.assertIn('$Port="80,8080"', h,
+ "port with multiple values not returned with multiple "
+ "values")
def test_no_return_comment(self):
c = CookieJar(DefaultCookiePolicy(rfc2965=True))
@@ -1105,8 +1103,8 @@ class LWPCookieTests(TestCase):
c.add_cookie_header(req)
h = req.get_header("Cookie")
- self.assertTrue("PART_NUMBER=ROCKET_LAUNCHER_0001" in h and
- "CUSTOMER=WILE_E_COYOTE" in h)
+ self.assertIn("PART_NUMBER=ROCKET_LAUNCHER_0001", h)
+ self.assertIn("CUSTOMER=WILE_E_COYOTE", h)
headers.append('Set-Cookie: SHIPPING=FEDEX; path=/foo')
res = FakeResponse(headers, "http://www.acme.com")
@@ -1116,17 +1114,17 @@ class LWPCookieTests(TestCase):
c.add_cookie_header(req)
h = req.get_header("Cookie")
- self.assertTrue("PART_NUMBER=ROCKET_LAUNCHER_0001" in h and
- "CUSTOMER=WILE_E_COYOTE" in h and
- "SHIPPING=FEDEX" not in h)
+ self.assertIn("PART_NUMBER=ROCKET_LAUNCHER_0001", h)
+ self.assertIn("CUSTOMER=WILE_E_COYOTE", h)
+ self.assertNotIn("SHIPPING=FEDEX", h)
req = urllib.request.Request("http://www.acme.com/foo/")
c.add_cookie_header(req)
h = req.get_header("Cookie")
- self.assertTrue(("PART_NUMBER=ROCKET_LAUNCHER_0001" in h and
- "CUSTOMER=WILE_E_COYOTE" in h and
- h.startswith("SHIPPING=FEDEX;")))
+ self.assertIn("PART_NUMBER=ROCKET_LAUNCHER_0001", h)
+ self.assertIn("CUSTOMER=WILE_E_COYOTE", h)
+ self.assertTrue(h.startswith("SHIPPING=FEDEX;"))
def test_netscape_example_2(self):
# Second Example transaction sequence:
@@ -1344,8 +1342,8 @@ class LWPCookieTests(TestCase):
# the server.
cookie = interact_2965(c, "http://www.acme.com/acme/parts/")
- self.assertTrue("Rocket_Launcher_0001" in cookie and
- "Riding_Rocket_0023" not in cookie)
+ self.assertIn("Rocket_Launcher_0001", cookie)
+ self.assertNotIn("Riding_Rocket_0023", cookie)
def test_rejection(self):
# Test rejection of Set-Cookie2 responses based on domain, path, port.