class TestErrorFunctions(unittest.TestCase):

    def setUp(self):
        # Instantiate an Error object
        self.error = Error("This is an error.")

    def tearDown(self):
        # Release instantiated objects
        del self.error

    def test_init(self):
        self.assertEqual(self.error.msg, "This is an error.")
        self.assertIsNone(self.error.excp)
        # The caller is the Error instantiation of the setUp() function, so please update these lines if needed
        self.assertEqual(self.error.frame_info.filename, utest_path + 'test_utils_error_handling.py')
        self.assertEqual(self.error.frame_info.lineno, 16)
        self.assertEqual(self.error.frame_info.function, 'setUp')
        self.assertListEqual(self.error.frame_info.code_context, ['        self.error = Error("This is an error.")\n'])

    def test_str(self):
        self.assertEqual(str(self.error), "  File \"" + utest_path + "test_utils_error_handling.py\", line 16, in setUp" + EOL + "    Error: This is an error.")

    def test_handle(self):
        test = False
        try:
            print
            self.error.handle()
        except SystemExit:
            test = True
        self.assertTrue(test)
 def setUp(self):
     # Instantiate an Error object
     self.error = Error("This is an error.")