Skip to content

Commit

Permalink
Fixed a unicode encoding case
Browse files Browse the repository at this point in the history
  • Loading branch information
pferate committed Jan 7, 2015
1 parent 391df3c commit 58a7962
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/test_json_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ def test_json_build_query(self):

query_dict = parse_qs(query[1:])
self.assertEqual(query_dict['foo'], ['1'])
self.assertEqual(query_dict['bar'], [u'\N{COMET}'.encode('utf-8')])
if isinstance(u'\N{COMET}', str):
# Python 3, no need to encode
self.assertEqual(query_dict['bar'], [u'\N{COMET}'])
else:
# Python 2, encode string
self.assertEqual(query_dict['bar'], [u'\N{COMET}'.encode('utf-8')])
self.assertEqual(query_dict['baz'], ['fe', 'fi', 'fo', 'fum'])
self.assertTrue('qux' not in query_dict)
self.assertEqual(body, '{}')
Expand Down

0 comments on commit 58a7962

Please sign in to comment.