def test_extra_data(self):
    test_cases = [('[]]', 'Extra data', 2), ('{}}', 'Extra data', 2), ('[],[]', 'Extra data', 2), ('{},{}', 'Extra data', 2)]
    test_cases += [('42,"spam"', 'Extra data', 2), ('"spam",42', 'Extra data', 6)]
    for (data, msg, idx) in test_cases:
        with self.assertRaises(self.JSONDecodeError) as cm:
            self.loads(data)
        err = cm.exception
        self.assertEqual(err.msg, msg)
        self.assertEqual(err.pos, idx)
        self.assertEqual(err.lineno, 1)
        self.assertEqual(err.colno, (idx + 1))
        self.assertEqual(str(err), ('%s: line 1 column %d (char %d)' % (msg, (idx + 1), idx)))
def test_extra_data(self):
    test_cases = [('[]]', 'Extra data', 2), ('{}}', 'Extra data', 2), ('[],[]', 'Extra data', 2), ('{},{}', 'Extra data', 2)]
    test_cases += [('42,"spam"', 'Extra data', 2), ('"spam",42', 'Extra data', 6)]
    for (data, msg, idx) in test_cases:
        with self.assertRaises(self.JSONDecodeError) as cm:
            self.loads(data)
        err = cm.exception
        self.assertEqual(err.msg, msg)
        self.assertEqual(err.pos, idx)
        self.assertEqual(err.lineno, 1)
        self.assertEqual(err.colno, (idx + 1))
        self.assertEqual(str(err), ('%s: line 1 column %d (char %d)' % (msg, (idx + 1), idx)))