python-unittest-check for exceptions

Run Settings
LanguagePython
Language Version
Run Command
# coding: utf-8 # https://stackoverflow.com/questions/129507/how-do-you-test-that-a-python-function-throws-an-exception import unittest def test(a): assert a >=0 class A(unittest.TestCase): def test_one(self): with self.assertRaises(AssertionError) as context: test(-5) # print context self.assertTrue(isinstance(context.exception, AssertionError)) print('erfolg') a = A() a.test_one()
Editor Settings
Theme
Key bindings
Full width
Lines