def test_errors(self):
        """Tests for errors thrown in context manager methods.

        """
        try:
            with parallel(error_in_enter()):
                pass
        except MultipleError, err:
            self.assertEqual(1, len(err.errors))
            self.assertEqual("enter", str(err.errors[0][1]))

        try:
            with parallel(error_in_exit()):
                pass
        except MultipleError, err:
            self.assertEqual(1, len(err.errors))
            self.assertEqual("exit", str(err.errors[0][1]))

        try:
            with parallel(error_in_enter(), error_in_exit()):
                pass
        except MultipleError, err:
            self.assertEqual(1, len(err.errors))
            self.assertEqual("enter", str(err.errors[0][1]))

        try:
            with parallel(error_in_enter(), error_in_enter()):
                pass
        except MultipleError, err:
            self.assertEqual(2, len(err.errors))
            self.assertEqual("enter", str(err.errors[0][1]))
            self.assertEqual("enter", str(err.errors[1][1]))

        try:
            with parallel(error_in_exit(), error_in_exit()):
                pass
        except MultipleError, err:
            self.assertEqual(2, len(err.errors))
            self.assertEqual("exit", str(err.errors[0][1]))
            self.assertEqual("exit", str(err.errors[1][1]))
Tests for errors thrown in context manager methods.

        
recipes/Python/577352_Starting_several_context_managers/recipe-577352.py