[Python-checkins] python/dist/src/Lib/test test_cookielib.py, 1.2, 1.3

loewis at users.sourceforge.net loewis at users.sourceforge.net
Thu Mar 3 11:57:39 CET 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6257/Lib/test

Modified Files:
	test_cookielib.py 
Log Message:
Patch #1117454: Remove code to special-case cookies without values
in LWPCookieJar. Backported to 2.4.


Index: test_cookielib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cookielib.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test_cookielib.py	3 Mar 2005 10:48:12 -0000	1.2
+++ test_cookielib.py	3 Mar 2005 10:57:37 -0000	1.3
@@ -231,6 +231,24 @@
     return cookie_hdr
 
 
+class FileCookieJarTests(TestCase):
+    def test_lwp_valueless_cookie(self):
+        # cookies with no value should be saved and loaded consistently
+        from cookielib import LWPCookieJar
+        filename = test_support.TESTFN
+        c = LWPCookieJar()
+        interact_netscape(c, "http://www.acme.com/", 'boo')
+        self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None)
+        try:
+            c.save(filename, ignore_discard=True)
+            c = LWPCookieJar()
+            c.load(filename, ignore_discard=True)
+        finally:
+            try: os.unlink(filename)
+            except OSError: pass
+        self.assertEqual(c._cookies["www.acme.com"]["/"]["boo"].value, None)
+
+
 class CookieTests(TestCase):
     # XXX
     # Get rid of string comparisons where not actually testing str / repr.
@@ -1636,6 +1654,7 @@
         DateTimeTests,
         HeaderTests,
         CookieTests,
+        FileCookieJarTests,
         LWPCookieTests,
         )
 



More information about the Python-checkins mailing list