aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-05 20:28:13 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-07-06 19:55:48 -0700
commitd406bee988dc01126cfbdfc938b561e10b518610 (patch)
treeb4ff8b9b6010817666afabf32bbfe27e8b9e3907 /test
parent48ee3a553e30b36c16bfbe1674d3313605dff661 (diff)
downloadmitmproxy-d406bee988dc01126cfbdfc938b561e10b518610.tar.gz
mitmproxy-d406bee988dc01126cfbdfc938b561e10b518610.tar.bz2
mitmproxy-d406bee988dc01126cfbdfc938b561e10b518610.zip
tnetstring3: adapt to unicode support
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_contrib_tnetstring.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/test/mitmproxy/test_contrib_tnetstring.py b/test/mitmproxy/test_contrib_tnetstring.py
index 8ae35a25..908cec27 100644
--- a/test/mitmproxy/test_contrib_tnetstring.py
+++ b/test/mitmproxy/test_contrib_tnetstring.py
@@ -15,7 +15,9 @@ FORMAT_EXAMPLES = {
{'hello': [12345678901, b'this', True, None, b'\x00\x00\x00\x00']},
b'5:12345#': 12345,
b'12:this is cool,': b'this is cool',
+ b'19:this is unicode \xe2\x98\x85;': u'this is unicode \u2605',
b'0:,': b'',
+ b'0:;': u'',
b'0:~': None,
b'4:true!': True,
b'5:false!': False,
@@ -78,12 +80,6 @@ class Test_Format(unittest.TestCase):
self.assertEqual(v, tnetstring.loads(tnetstring.dumps(v)))
self.assertEqual((v, b""), tnetstring.pop(tnetstring.dumps(v)))
- def test_unicode_handling(self):
- with self.assertRaises(ValueError):
- tnetstring.dumps(u"hello")
- self.assertEqual(tnetstring.dumps(u"hello".encode()), b"5:hello,")
- self.assertEqual(type(tnetstring.loads(b"5:hello,")), bytes)
-
def test_roundtrip_format_unicode(self):
for _ in range(500):
v = get_random_object()