MCPcopy Index your code
hub / github.com/python/cpython / testRaisesControlCharacters

Method testRaisesControlCharacters

Lib/test/test_wsgiref.py:858–875  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

856 self.assertIsNotNone(h.environ)
857
858 def testRaisesControlCharacters(self):
859 for c0 in control_characters_c0():
860 with self.subTest(c0):
861 base = BaseHandler()
862 with self.assertRaises(ValueError):
863 base.start_response(c0, [('x', 'y')])
864
865 base = BaseHandler()
866 with self.assertRaises(ValueError):
867 base.start_response('200 OK', [(c0, 'y')])
868
869 # HTAB (\x09) is allowed in header values, but not in names.
870 base = BaseHandler()
871 if c0 != "\t":
872 with self.assertRaises(ValueError):
873 base.start_response('200 OK', [('x', c0)])
874 else:
875 base.start_response('200 OK', [('x', c0)])
876
877
878class TestModule(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

start_responseMethod · 0.95
control_characters_c0Function · 0.90
BaseHandlerClass · 0.90
subTestMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected