Skip to content

Commit 010fd50

Browse files
Update test_wsgiref.py
1 parent 8b149df commit 010fd50

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Lib/test/test_wsgiref.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,17 @@ def write(self, b):
849849
self.assertIsNotNone(h.status)
850850
self.assertIsNotNone(h.environ)
851851

852+
def testRaisesControlCharacters(self):
853+
for c0 in control_characters_c0():
854+
with self.subTest(c0):
855+
base = BaseHandler()
856+
# HTAB (\x09) is allowed in values, but not in names.
857+
if c0 == "\t":
858+
base["key"] = f"val{c0}"
859+
base.start_response(f"key{c0}", headers)
860+
else:
861+
self.assertRaises(ValueError, base.start_response, f"key{c0}", headers)
862+
852863

853864
class TestModule(unittest.TestCase):
854865
def test_deprecated__version__(self):

0 commit comments

Comments
 (0)