ivoire/transform.py
def transform_example_body(self, body, context_variable):
        """
        Transform the body of an ``Example`` into the body of a method.

        Replaces instances of ``context_variable`` to refer to ``self``.

        ``body`` is the body.
        ``context_variable`` is the name bound in the surrounding context
        manager to the example (usually "test").

        """

        for node in body:
            for child in ast.walk(node):
                if isinstance(child, ast.Name):
                    if child.id == context_variable:
                        child.id = "self"
            yield node
def transform_example_body(self, body, context_variable):
        """
        Transform the body of an ``Example`` into the body of a method.

        Replaces instances of ``context_variable`` to refer to ``self``.

        ``body`` is the body.
        ``context_variable`` is the name bound in the surrounding context
        manager to the example (usually "test").

        """

        for node in body:
            for child in ast.walk(node):
                if isinstance(child, ast.Name):
                    if child.id == context_variable:
                        child.id = "self"
            yield node
Transform the body of an ``Example`` into the body of a method.

        Replaces instances of ``context_variable`` to refer to ``self``.

        ``body`` is the body.
        ``context_variable`` is the name bound in the surrounding context
        manager to the example (usually "test").