f13f59a3b9951c8817a9db61acf3e8a6a9da8d09,lib/python/http_test.py,RespondTest,testResponseCharsetTranscoding,#RespondTest#,62
Before Change
http.Respond(
hand, {"red": bean.encode("gbk")}, "application/json; charset=gbk",
encoding="gbk")
hand.wfile.write.assert_called_with(
b"{"red": "" + bean.encode("gbk") + b""}")
def testAcceptGzip_compressesResponse(self):
fall_of_hyperion_canto1_stanza1 = "\n".join([
"Fanatics have their dreams, wherewith they weave",
After Change
self.assertEqual(r.response[0], bean.encode("gbk"))
// input is object with unicode strings, output is gbk json
q = wrappers.Request(wtest.EnvironBuilder().get_environ())
r = http.Respond(q, {"red": bean}, "application/json; charset=gbk")
self.assertEqual(r.response[0], b"{"red": "" + bean.encode("gbk") + b""}")
// input is object with utf-8 strings, output is gbk json
q = wrappers.Request(wtest.EnvironBuilder().get_environ())
r = http.Respond(q, {"red": bean.encode("utf-8")},
"application/json; charset=gbk")
self.assertEqual(r.response[0], b"{"red": "" + bean.encode("gbk") + b""}")
// input is object with gbk strings, output is gbk json
q = wrappers.Request(wtest.EnvironBuilder().get_environ())
r = http.Respond(
q, {"red": bean.encode("gbk")},
"application/json; charset=gbk",
encoding="gbk")
self.assertEqual(r.response[0], b"{"red": "" + bean.encode("gbk") + b""}")
def testAcceptGzip_compressesResponse(self):
fall_of_hyperion_canto1_stanza1 = "\n".join([
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 12
Instances
Project Name: tensorflow/tensorboard
Commit Name: f13f59a3b9951c8817a9db61acf3e8a6a9da8d09
Time: 2017-01-21
Author: dandelion@google.com
File Name: lib/python/http_test.py
Class Name: RespondTest
Method Name: testResponseCharsetTranscoding
Project Name: tensorflow/tensorboard
Commit Name: f13f59a3b9951c8817a9db61acf3e8a6a9da8d09
Time: 2017-01-21
Author: dandelion@google.com
File Name: lib/python/http_test.py
Class Name: RespondTest
Method Name: testResponseCharsetTranscoding
Project Name: tensorflow/tensorboard
Commit Name: f13f59a3b9951c8817a9db61acf3e8a6a9da8d09
Time: 2017-01-21
Author: dandelion@google.com
File Name: lib/python/http_test.py
Class Name: RespondTest
Method Name: testContentLength_isInBytes
Project Name: tensorflow/tensorboard
Commit Name: f13f59a3b9951c8817a9db61acf3e8a6a9da8d09
Time: 2017-01-21
Author: dandelion@google.com
File Name: lib/python/http_test.py
Class Name: RespondTest
Method Name: testAcceptGzip_compressesResponse