def test_weirdCallable(self):
        """
        Errors raised by coerce functions are handled properly.
        """
        us = WeirdCallableOptions()
        argV = "--foowrong blah".split()
        # ValueError is swallowed as UsageError
        e = self.assertRaises(usage.UsageError, us.parseOptions, argV)
        self.assertEqual(str(e), "Parameter type enforcement failed: Yay")

        us = WeirdCallableOptions()
        argV = "--barwrong blah".split()
        # RuntimeError is not swallowed
        self.assertRaises(RuntimeError, us.parseOptions, argV)

        Errors raised by coerce functions are handled properly.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_usage.py