# Path: jasper/steps.py
# class Step(object):
#     """
#     The Step class is used as a wrapper around functions for testing behaviours.
#     """
#     def __init__(self, function, **kwargs):
#         """
#         Initialize a new Step object.
# 
#         :param function: The function this step will call when this step is run.
#         :param kwargs: Kwargs to call the given function with.
#         """
#         self.function = function
#         self.kwargs = kwargs
#         self.ran = False
#         self.passed = False
# 
#     async def run(self, context):
#         """
#         Run this step and record the results.
# 
#         :param context: A context object too pass into this steps function.
#         """
#         try:
#             if asyncio.iscoroutinefunction(self.function):
#                 await self.function(context, **self.kwargs)
#             else:
#                 self.function(context, **self.kwargs)
#         except Exception:
#             raise
#         else:
#             self.passed = True
#         finally:
#             self.ran = True
# 
# Path: jasper/exceptions.py
# class ValidationException(Exception):
#     """
#     An Exception that is thrown when an object fails validation during construction.
#     """
#     pass


from jasper.steps import Step
from jasper.exceptions import ValidationException
        self.description = description

        self.given = given if type(given) == list else [given]
        self.when = when if type(when) == list else [when]
        self.then = then if type(then) == list else [then]

        self.before_each = before_each if type(before_each) == list else [before_each]
        self.before_all = before_all if type(before_all) == list else [before_all]

        self.after_each = after_each if type(after_each) == list else [after_each]
        self.after_all = after_all if type(after_all) == list else [after_all]

        self.exception = None
        self.ran = False
        self.passed = False

        self.__validate()

    def __validate(self):
        self.__validate_steps(self.given, 'Given')
        self.__validate_steps(self.when, 'When')
        self.__validate_steps(self.then, 'Then')
        self.__validate_steps(self.before_each, 'BeforeEach')
        self.__validate_steps(self.after_each, 'AfterEach')
        self.__validate_steps(self.before_all, 'BeforeAll')
        self.__validate_steps(self.after_all, 'AfterAll')

    def __validate_steps(self, steps, step_type):
        for step in steps:
            if not isinstance(step, Step):

# Path: jasper/steps.py
# class Step(object):
#     """
#     The Step class is used as a wrapper around functions for testing behaviours.
#     """
#     def __init__(self, function, **kwargs):
#         """
#         Initialize a new Step object.
# 
#         :param function: The function this step will call when this step is run.
#         :param kwargs: Kwargs to call the given function with.
#         """
#         self.function = function
#         self.kwargs = kwargs
#         self.ran = False
#         self.passed = False
# 
#     async def run(self, context):
#         """
#         Run this step and record the results.
# 
#         :param context: A context object too pass into this steps function.
#         """
#         try:
#             if asyncio.iscoroutinefunction(self.function):
#                 await self.function(context, **self.kwargs)
#             else:
#                 self.function(context, **self.kwargs)
#         except Exception:
#             raise
#         else:
#             self.passed = True
#         finally:
#             self.ran = True
# 
# Path: jasper/exceptions.py
# class ValidationException(Exception):
#     """
#     An Exception that is thrown when an object fails validation during construction.
#     """
#     pass


# Path: jasper/scenario.py
from jasper.steps import Step
from jasper.exceptions import ValidationException

        self.description = description

        self.given = given if type(given) == list else [given]
        self.when = when if type(when) == list else [when]
        self.then = then if type(then) == list else [then]

        self.before_each = before_each if type(before_each) == list else [before_each]
        self.before_all = before_all if type(before_all) == list else [before_all]

        self.after_each = after_each if type(after_each) == list else [after_each]
        self.after_all = after_all if type(after_all) == list else [after_all]

        self.exception = None
        self.ran = False
        self.passed = False

        self.__validate()

    def __validate(self):
        self.__validate_steps(self.given, 'Given')
        self.__validate_steps(self.when, 'When')
        self.__validate_steps(self.then, 'Then')
        self.__validate_steps(self.before_each, 'BeforeEach')
        self.__validate_steps(self.after_each, 'AfterEach')
        self.__validate_steps(self.before_all, 'BeforeAll')
        self.__validate_steps(self.after_all, 'AfterAll')

    def __validate_steps(self, steps, step_type):
        for step in steps:
            if not isinstance(step, Step):

                raise ValidationException(f'\n\nScenario \'{self.description}\'. '