def test_loader_populates_registry_from_given_file_content(self): content = dedent(""" @step("print hello") def printf(): print("hello") @step("print <hello>.") def print_word(word): print(word) """) load_steps(Parser.parse("foo.py", content)) self.assertTrue(registry.is_implemented("print hello")) self.assertTrue(registry.is_implemented("print {}.")) self.assertEqual(len(registry.steps()), 2)
def test_loader_populates_registry_from_given_file_content(self): content = """ @step("print hello") def print(): print("hello") @step("print <hello>.") def print_word(word): print(word) """ ast = generate_ast(content, "foo.py") load_steps(ast, "foo.py") self.assertTrue(registry.is_implemented("print hello")) self.assertTrue(registry.is_implemented("print {}.")) self.assertEqual(len(registry.steps()), 2)
def GetStepNames(self, request, context): res = StepNamesResponse() res.steps.extend(registry.steps()) return res
def _send_all_step_names(_request, response, _socket): response.messageType = Message.StepNamesResponse response.stepNamesResponse.steps.extend(registry.steps())
def test_step_decorator(self): steps = registry.steps() expected = {'Step 1', 'Step 2'} self.assertEqual(expected, set(steps))
def _send_all_step_names(request, response, socket): response.messageType = Message.StepNamesResponse response.stepNamesResponse.steps.extend(registry.steps())
def process_step_names_request(): response = StepNamesResponse() response.steps.extend(registry.steps()) return response