

def test_set_catch_exceptions(self):
    application = Application()
    application.set_auto_exit(False)
    application.get_terminal_width = self.mock().MagicMock(return_value=120)
    tester = ApplicationTester(application)
    application.set_catch_exceptions(True)
    tester.run([('command', 'foo')], {
        'decorated': False,
    })
    self.assertEqual(self.open_fixture('application_renderexception1.txt'), tester.get_display())
    application.set_catch_exceptions(False)
    try:
        tester.run([('command', 'foo')], {
            'decorated': False,
        })
        self.fail('.set_catch_exceptions() sets the catch exception flag')
    except Exception as e:
        self.assertEqual('Command "foo" is not defined.', str(e))

dataset/ETHPy150Open sdispater/cleo/tests/test_application.py ApplicationTest.test_set_catch_exceptions/original