summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_http_cookies.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2018-04-22 23:48:11 (GMT)
committerGitHub <noreply@github.com>2018-04-22 23:48:11 (GMT)
commitd5a2377c3d70e4143bcbee4a765b3434e21f683a (patch)
treefb88557cdcf43ba46a8c2e889f2beed603970947 /Lib/test/test_http_cookies.py
parentb81ca28b378c8b29204a37f8bd433a3379f53f7d (diff)
downloadcpython-d5a2377c3d70e4143bcbee4a765b3434e21f683a.zip
cpython-d5a2377c3d70e4143bcbee4a765b3434e21f683a.tar.gz
cpython-d5a2377c3d70e4143bcbee4a765b3434e21f683a.tar.bz2
bpo-991266: Fix quoting of Comment attribute of SimpleCookie (GH-6555)
Diffstat (limited to 'Lib/test/test_http_cookies.py')
-rw-r--r--Lib/test/test_http_cookies.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_http_cookies.py b/Lib/test/test_http_cookies.py
index 447f883..6072c7e 100644
--- a/Lib/test/test_http_cookies.py
+++ b/Lib/test/test_http_cookies.py
@@ -220,6 +220,16 @@ class CookieTests(unittest.TestCase):
with self.assertRaises(cookies.CookieError):
C.load(rawdata)
+ def test_comment_quoting(self):
+ c = cookies.SimpleCookie()
+ c['foo'] = '\N{COPYRIGHT SIGN}'
+ self.assertEqual(str(c['foo']), 'Set-Cookie: foo="\\251"')
+ c['foo']['comment'] = 'comment \N{COPYRIGHT SIGN}'
+ self.assertEqual(
+ str(c['foo']),
+ 'Set-Cookie: foo="\\251"; Comment="comment \\251"'
+ )
+
class MorselTests(unittest.TestCase):
"""Tests for the Morsel object."""