def test_StepDict_can_load_a_step_composed_of_a_regex_and_a_function(): "lettuce.STEP_REGISTRY.load(step, func) append item(step, func) to STEP_REGISTRY" steps = StepDict() func = lambda: "" step = "a step to test" steps.load(step, func) assert (step in steps) assert_equal(steps[step], func)
def test_StepDict_load_a_step_return_the_given_function(): "lettuce.STEP_REGISTRY.load(step, func) returns func" steps = StepDict() func = lambda: "" assert_equal(steps.load("another step", func), func)
def test_StepDict_raise_StepLoadingError_if_load_first_argument_is_not_a_regex( ): "lettuce.STEP_REGISTRY.load(step, func) should raise an error if step is not a regex" steps = StepDict() test_load = lambda: steps.load("an invalid regex;)", lambda: "") assert_raises(StepLoadingError, test_load)
def test_StepDict_raise_StepLoadingError_if_load_first_argument_is_not_a_regex(): "lettuce.STEP_REGISTRY.load(step, func) should raise an error if step is not a regex" steps = StepDict() test_load = lambda: steps.load("an invalid regex;)", lambda: "") assert_raises(StepLoadingError, test_load)