def test_raises_SyntaxError_if_no_match(self): with self.assertRaises(SyntaxError) as assertion: configparser.parse_exception_handler_spec(': handler') self.assertEqual( str(assertion.exception), 'expecting exception handler spec' )
def test_many_types(self): types, handler = configparser.parse_exception_handler_spec( 'exc1, exc2: handler') self.assertEqual(types, ('exc1', 'exc2')) self.assertEqual(handler, 'handler')
def test_single_type(self): types, handler = configparser.parse_exception_handler_spec( 'exc: handler') self.assertEqual(types, ('exc',)) self.assertEqual(handler, 'handler')