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

Method test_fatal_error

Lib/idlelib/idle_test/test_run.py:374–397  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

372class HandleErrorTest(unittest.TestCase):
373 # Method of MyRPCServer
374 def test_fatal_error(self):
375 eq = self.assertEqual
376 with captured_output('__stderr__') as err,\
377 mock.patch('idlelib.run.thread.interrupt_main',
378 new_callable=Func) as func:
379 try:
380 raise EOFError
381 except EOFError:
382 run.MyRPCServer.handle_error(None, 'abc', '123')
383 eq(run.exit_now, True)
384 run.exit_now = False
385 eq(err.getvalue(), '')
386
387 try:
388 raise IndexError
389 except IndexError:
390 run.MyRPCServer.handle_error(None, 'abc', '123')
391 eq(run.quitting, True)
392 run.quitting = False
393 msg = err.getvalue()
394 self.assertIn('abc', msg)
395 self.assertIn('123', msg)
396 self.assertIn('IndexError', msg)
397 eq(func.called, 2)
398
399
400class ExecRuncodeTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

captured_outputFunction · 0.90
eqFunction · 0.85
assertInMethod · 0.80
handle_errorMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected