class TestSortedJSONParser(unittest.TestCase):
    def setUp(self):
        super(TestSortedJSONParser, self).setUp()
        self.parser = SortedJSONParser()

    def test_parser(self):
        content = json.dumps({"hello": "world"}).encode("utf-8")
        stream = six.BytesIO(content)

        actual_data = self.parser.parse(stream=stream)

        self.assertEqual(actual_data, OrderedDict([("hello", "world")]))

    def test_parser_invalid_json(self):
        content = json.dumps({"hello": "world"}).replace('"', "'").encode("utf-8")
        stream = six.BytesIO(content)

        with self.assertRaises(parsers.ParseError):
            self.parser.parse(stream=stream)
class TestSortedJSONParser(unittest.TestCase):
    def setUp(self):
        super(TestSortedJSONParser, self).setUp()
        self.parser = SortedJSONParser()

    def test_parser(self):
        content = json.dumps({'hello': 'world'}).encode('utf-8')
        stream = six.BytesIO(content)

        actual_data = self.parser.parse(stream=stream)

        self.assertEqual(actual_data, OrderedDict([('hello', 'world')]))

    def test_parser_invalid_json(self):
        content = (json.dumps({
            'hello': 'world'
        }).replace('"', "'").encode('utf-8'))
        stream = six.BytesIO(content)

        with self.assertRaises(parsers.ParseError):
            self.parser.parse(stream=stream)
 def setUp(self):
     super(TestSortedJSONParser, self).setUp()
     self.parser = SortedJSONParser()
 def setUp(self):
     super(TestSortedJSONParser, self).setUp()
     self.parser = SortedJSONParser()