MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_control_characters

Method test_control_characters

Lib/test/test_http_cookies.py:575–597  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

573 r'expires=\w+, \d+ \w+ \d+ \d+:\d+:\d+ \w+')
574
575 def test_control_characters(self):
576 for c0 in support.control_characters_c0():
577 morsel = cookies.Morsel()
578
579 # .__setitem__()
580 with self.assertRaises(cookies.CookieError):
581 morsel[c0] = "val"
582 with self.assertRaises(cookies.CookieError):
583 morsel["path"] = c0
584
585 # .setdefault()
586 with self.assertRaises(cookies.CookieError):
587 morsel.setdefault("path", c0)
588 with self.assertRaises(cookies.CookieError):
589 morsel.setdefault(c0, "val")
590
591 # .set()
592 with self.assertRaises(cookies.CookieError):
593 morsel.set(c0, "val", "coded-value")
594 with self.assertRaises(cookies.CookieError):
595 morsel.set("path", c0, "coded-value")
596 with self.assertRaises(cookies.CookieError):
597 morsel.set("path", "val", c0)
598
599 def test_control_characters_output(self):
600 # Tests that even if the internals of Morsel are modified

Callers

nothing calls this directly

Calls 3

setdefaultMethod · 0.95
setMethod · 0.95
assertRaisesMethod · 0.45

Tested by

no test coverage detected