mirror of
https://github.com/python/cpython.git
synced 2025-10-28 01:00:34 +00:00
bpo-991266: Fix quoting of Comment attribute of SimpleCookie (GH-6555)
This commit is contained in:
parent
b81ca28b37
commit
d5a2377c3d
3 changed files with 13 additions and 0 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue