
import unittest


class MyException(Exception):
    def __init__(self, message):
        self.message = message


def RaiseException(message):
    raise MyException(message)


class ExceptionTest(unittest.TestCase):
    def verifyComplexException(self, exception_class, message, callable, *args):
        with self.assertRaises(exception_class) as cm:
            callable(*args)

        exception = cm.exception
        self.assertEqual(exception.message, message)

    def testRaises(self):
        self.verifyComplexException(MyException, 'asdf', RaiseException, 'asdf')


if __name__ == '__main__':
    unittest.main()


"""Demonstration of catching an exception and verifying its fields."""

import unittest


class MyException(Exception):
    def __init__(self, message):
        self.message = message


def RaiseException(message):
    raise MyException(message)


class ExceptionTest(unittest.TestCase):
    def verifyComplexException(self, exception_class, message, callable, *args):
        with self.assertRaises(exception_class) as cm:
            callable(*args)

        exception = cm.exception
        self.assertEqual(exception.message, message)

    def testRaises(self):
        self.verifyComplexException(MyException, 'asdf', RaiseException, 'asdf')


if __name__ == '__main__':
    unittest.main()

Convert top-level-comment to a docstring.
Convert top-level-comment to a docstring.

+ 
+ """Demonstration of catching an exception and verifying its fields."""
  
  import unittest
  
  
  class MyException(Exception):
      def __init__(self, message):
          self.message = message
  
  
  def RaiseException(message):
      raise MyException(message)
  
  
  class ExceptionTest(unittest.TestCase):
      def verifyComplexException(self, exception_class, message, callable, *args):
          with self.assertRaises(exception_class) as cm:
              callable(*args)
  
          exception = cm.exception
          self.assertEqual(exception.message, message)
  
      def testRaises(self):
          self.verifyComplexException(MyException, 'asdf', RaiseException, 'asdf')
  
  
  if __name__ == '__main__':
      unittest.main()
  
Convert top-level-comment to a docstring.
## Code Before:

import unittest


class MyException(Exception):
    def __init__(self, message):
        self.message = message


def RaiseException(message):
    raise MyException(message)


class ExceptionTest(unittest.TestCase):
    def verifyComplexException(self, exception_class, message, callable, *args):
        with self.assertRaises(exception_class) as cm:
            callable(*args)

        exception = cm.exception
        self.assertEqual(exception.message, message)

    def testRaises(self):
        self.verifyComplexException(MyException, 'asdf', RaiseException, 'asdf')


if __name__ == '__main__':
    unittest.main()

## Instruction:
Convert top-level-comment to a docstring.
## Code After:

"""Demonstration of catching an exception and verifying its fields."""

import unittest


class MyException(Exception):
    def __init__(self, message):
        self.message = message


def RaiseException(message):
    raise MyException(message)


class ExceptionTest(unittest.TestCase):
    def verifyComplexException(self, exception_class, message, callable, *args):
        with self.assertRaises(exception_class) as cm:
            callable(*args)

        exception = cm.exception
        self.assertEqual(exception.message, message)

    def testRaises(self):
        self.verifyComplexException(MyException, 'asdf', RaiseException, 'asdf')


if __name__ == '__main__':
    unittest.main()
