MCPcopy Create free account
hub / github.com/simplejson/simplejson / test_bytes_decode

Method test_bytes_decode

simplejson/tests/test_decode.py:95–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

93 cls().raw_decode(" \n{\"a\": {}}"))
94
95 def test_bytes_decode(self):
96 cls = json.decoder.JSONDecoder
97 data = b('"\xe2\x82\xac"')
98 self.assertEqual(cls().decode(data), u'\u20ac')
99 self.assertEqual(cls(encoding='latin1').decode(data), u'\xe2\x82\xac')
100 self.assertEqual(cls(encoding=None).decode(data), u'\u20ac')
101
102 data = MisbehavingBytesSubtype(b('"\xe2\x82\xac"'))
103 self.assertEqual(cls().decode(data), u'\u20ac')
104 self.assertEqual(cls(encoding='latin1').decode(data), u'\xe2\x82\xac')
105 self.assertEqual(cls(encoding=None).decode(data), u'\u20ac')
106
107 def test_bounds_checking(self):
108 # https://github.com/simplejson/simplejson/issues/98

Callers

nothing calls this directly

Calls 3

bFunction · 0.90
decodeMethod · 0.45

Tested by

no test coverage detected