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

Method test_cp1252_url

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

Source from the content-addressed store, hash-verified

214 out)
215
216 def test_cp1252_url(self):
217 def app(e, s):
218 s("200 OK", [
219 ("Content-Type", "text/plain"),
220 ("Date", "Wed, 24 Dec 2008 13:29:32 GMT"),
221 ])
222 # PEP3333 says environ variables are decoded as latin1.
223 # Encode as latin1 to get original bytes
224 return [e["PATH_INFO"].encode("latin1")]
225
226 out, err = run_amock(
227 validator(app), data=b"GET /\x80%80 HTTP/1.0")
228 self.assertEqual(
229 [
230 b"HTTP/1.0 200 OK",
231 mock.ANY,
232 b"Content-Type: text/plain",
233 b"Date: Wed, 24 Dec 2008 13:29:32 GMT",
234 b"",
235 b"/\x80\x80",
236 ],
237 out.splitlines())
238
239 def test_interrupted_write(self):
240 # BaseHandler._write() and _flush() have to write all data, even if

Callers

nothing calls this directly

Calls 4

validatorFunction · 0.90
run_amockFunction · 0.85
assertEqualMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected