def test_raises_SyntaxError_if_no_match(self): with self.assertRaises(SyntaxError) as assertion: configparser.parse_handler_spec('42') self.assertEqual( str(assertion.exception), 'expecting handler spec')
def test_handler_with_name(self): handler, name = configparser.parse_handler_spec('foo.bar (baz)') self.assertEqual(handler, 'foo.bar') self.assertEqual(name, 'baz')
def test_with_trailing_colon(self): handler, name = configparser.parse_handler_spec('foo.bar:') self.assertEqual(handler, 'foo.bar') self.assertIs(name, None)
def test_just_a_handler(self): handler, name = configparser.parse_handler_spec('foo.bar') self.assertEqual(handler, 'foo.bar') self.assertIs(name, None)