ivoire/transform.py
def transform_example(self, node, name, context_variable, group_variable):
        """
        Transform an example node into a test method.

        Returns the unchanged node if it wasn't an ``Example``.

        ``node`` is the node object.
        ``name`` is the name of the example being described.
        ``context_variable`` is the name bound in the context manager (usually
        "test").
        ``group_variable`` is the name bound in the surrounding example group's
        context manager (usually "it").

        """

        test_name = "_".join(["test", group_variable] + name.split())
        body = self.transform_example_body(node.body, context_variable)

        return ast.FunctionDef(
            name=test_name,
            args=self.takes_only_self(),
            body=list(body),
            decorator_list=[],
        )
def transform_example(self, node, name, context_variable, group_variable):
        """
        Transform an example node into a test method.

        Returns the unchanged node if it wasn't an ``Example``.

        ``node`` is the node object.
        ``name`` is the name of the example being described.
        ``context_variable`` is the name bound in the context manager (usually
        "test").
        ``group_variable`` is the name bound in the surrounding example group's
        context manager (usually "it").

        """

        test_name = "_".join(["test", group_variable] + name.split())
        body = self.transform_example_body(node.body, context_variable)

        return ast.FunctionDef(
            name=test_name,
            args=self.takes_only_self(),
            body=list(body),
            decorator_list=[],
        )
Transform an example node into a test method.

        Returns the unchanged node if it wasn't an ``Example``.

        ``node`` is the node object.
        ``name`` is the name of the example being described.
        ``context_variable`` is the name bound in the context manager (usually
        "test").
        ``group_variable`` is the name bound in the surrounding example group's
        context manager (usually "it").