def test_string_stream(self): with warnings.catch_warnings(record=True) as warns: events = list(self.backend.basic_parse(StringIO(b2s(JSON)))) self.assertEqual(events, JSON_EVENTS) if self.warn_on_string_stream: self.assertEqual(len(warns), 1) self.assertEqual(DeprecationWarning, warns[0].category)
def _reader(self, json): if type(json) == compat.bytetype: return BytesIO(json) return StringIO(json)
def test_string(self): l = Lexer(StringIO(JSON.decode('utf-8'))) self.assertEqual(next(l)[1], '{')