def test_truncated_input(self):
    test_cases = [('', 'Expecting value', 0), ('[', 'Expecting value', 1), ('[42', "Expecting ',' delimiter", 3), ('[42,', 'Expecting value', 4), ('["', 'Unterminated string starting at', 1), ('["spam', 'Unterminated string starting at', 1), ('["spam"', "Expecting ',' delimiter", 7), ('["spam",', 'Expecting value', 8), ('{', 'Expecting property name enclosed in double quotes', 1), ('{"', 'Unterminated string starting at', 1), ('{"spam', 'Unterminated string starting at', 1), ('{"spam"', "Expecting ':' delimiter", 7), ('{"spam":', 'Expecting value', 8), ('{"spam":42', "Expecting ',' delimiter", 10), ('{"spam":42,', 'Expecting property name enclosed in double quotes', 11)]
    test_cases += [('"', 'Unterminated string starting at', 0), ('"spam', 'Unterminated string starting at', 0)]
    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_truncated_input(self):
    test_cases = [(, 'Expecting value', 0), ('[', 'Expecting value', 1), ('[42', "Expecting ',' delimiter", 3), ('[42,', 'Expecting value', 4), ('["', 'Unterminated string starting at', 1), ('["spam', 'Unterminated string starting at', 1), ('["spam"', "Expecting ',' delimiter", 7), ('["spam",', 'Expecting value', 8), ('{', 'Expecting property name enclosed in double quotes', 1), ('{"', 'Unterminated string starting at', 1), ('{"spam', 'Unterminated string starting at', 1), ('{"spam"', "Expecting ':' delimiter", 7), ('{"spam":', 'Expecting value', 8), ('{"spam":42', "Expecting ',' delimiter", 10), ('{"spam":42,', 'Expecting property name enclosed in double quotes', 11)]
    test_cases += [('"', 'Unterminated string starting at', 0), ('"spam', 'Unterminated string starting at', 0)]
    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)))