MCPcopy Index your code
hub / github.com/python/cpython / test_indentation_error

Method test_indentation_error

Lib/test/test_code_module.py:114–128  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

112 self.assertIs(self.sysmod.last_exc, self.sysmod.last_value)
113
114 def test_indentation_error(self):
115 self.infunc.side_effect = [" 1", EOFError('Finished')]
116 self.console.interact()
117 output = ''.join(''.join(call[1]) for call in self.stderr.method_calls)
118 output = output[output.index('(InteractiveConsole)'):]
119 output = output[:output.index('\nnow exiting')]
120 self.assertEqual(output.splitlines()[1:], [
121 ' File "<console>", line 1',
122 ' 1',
123 'IndentationError: unexpected indent'])
124 self.assertIs(self.sysmod.last_type, IndentationError)
125 self.assertIs(type(self.sysmod.last_value), IndentationError)
126 self.assertIsNone(self.sysmod.last_traceback)
127 self.assertIsNone(self.sysmod.last_value.__traceback__)
128 self.assertIs(self.sysmod.last_exc, self.sysmod.last_value)
129
130 def test_unicode_error(self):
131 self.infunc.side_effect = ["'\ud800'", EOFError('Finished')]

Callers

nothing calls this directly

Calls 7

assertIsNoneMethod · 0.80
interactMethod · 0.45
joinMethod · 0.45
indexMethod · 0.45
assertEqualMethod · 0.45
splitlinesMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected