f13f59a3b9951c8817a9db61acf3e8a6a9da8d09,lib/python/http_test.py,RespondTest,testResponseCharsetTranscoding,#RespondTest#,62

Before Change


    hand.wfile.write.assert_called_with(bean.encode("gbk"))

    // input is utf-8 string, output is gbk string
    hand = _create_mocked_handler()
    http.Respond(hand, bean.encode("utf-8"), "text/plain; charset=gbk")
    hand.wfile.write.assert_called_with(bean.encode("gbk"))

    // input is object with unicode strings, output is gbk json
    hand = _create_mocked_handler()

After Change


    self.assertEqual(r.response[0], bean.encode("gbk"))

    // input is utf-8 string, output is gbk string
    q = wrappers.Request(wtest.EnvironBuilder().get_environ())
    r = http.Respond(q, bean.encode("utf-8"), "text/plain; charset=gbk")
    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())
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

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