def test_unexpected_data(self):
    test_cases = [('[,', 'Expecting value', 1), ('{"spam":[}', 'Expecting value', 9), ('[42:', "Expecting ',' delimiter", 3), ('[42 "spam"', "Expecting ',' delimiter", 4), ('[42,]', 'Expecting value', 4), ('{"spam":[42}', "Expecting ',' delimiter", 11), ('["]', 'Unterminated string starting at', 1), ('["spam":', "Expecting ',' delimiter", 7), ('["spam",]', 'Expecting value', 8), ('{:', 'Expecting property name enclosed in double quotes', 1), ('{,', 'Expecting property name enclosed in double quotes', 1), ('{42', 'Expecting property name enclosed in double quotes', 1), ('[{]', 'Expecting property name enclosed in double quotes', 2), ('{"spam",', "Expecting ':' delimiter", 7), ('{"spam"}', "Expecting ':' delimiter", 7), ('[{"spam"]', "Expecting ':' delimiter", 8), ('{"spam":}', 'Expecting value', 8), ('[{"spam":]', 'Expecting value', 9), ('{"spam":42 "ham"', "Expecting ',' delimiter", 11), ('[{"spam":42]', "Expecting ',' delimiter", 11), ('{"spam":42,}', 'Expecting property name enclosed in double quotes', 11)]
    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_unexpected_data(self):
    test_cases = [('[,', 'Expecting value', 1), ('{"spam":[}', 'Expecting value', 9), ('[42:', "Expecting ',' delimiter", 3), ('[42 "spam"', "Expecting ',' delimiter", 4), ('[42,]', 'Expecting value', 4), ('{"spam":[42}', "Expecting ',' delimiter", 11), ('["]', 'Unterminated string starting at', 1), ('["spam":', "Expecting ',' delimiter", 7), ('["spam",]', 'Expecting value', 8), ('{:', 'Expecting property name enclosed in double quotes', 1), ('{,', 'Expecting property name enclosed in double quotes', 1), ('{42', 'Expecting property name enclosed in double quotes', 1), ('[{]', 'Expecting property name enclosed in double quotes', 2), ('{"spam",', "Expecting ':' delimiter", 7), ('{"spam"}', "Expecting ':' delimiter", 7), ('[{"spam"]', "Expecting ':' delimiter", 8), ('{"spam":}', 'Expecting value', 8), ('[{"spam":]', 'Expecting value', 9), ('{"spam":42 "ham"', "Expecting ',' delimiter", 11), ('[{"spam":42]', "Expecting ',' delimiter", 11), ('{"spam":42,}', 'Expecting property name enclosed in double quotes', 11)]
    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)))