patrys/httmock — pull request #10 by gmr (2013-09-26 00:17:24+00:00)
Title: Support Python 3 JSON serialization of a dict passed into httmock.response

If relying on the response content auto-serialization of dict to JSON, Python 3 evaluations of the response content fail with a type error due to how requests.utils.guess_json_utf() attempts to figure out if the content is UTF-8 or not.

This commit adds:

1. A fix for the issue, checking to see if the Python version is 3 and casting the JSON serialized string to a bytes object
2. Fix for the ResponseTest.test_response_auto_json test, ensuring that the right evaluation is performed for Python 2 vs Python 3
3. a unit test for the specific Python 3 error encountered in the requests library due to how JSON serialization was handled.