Skip to content

Doctest snippets in Template docstrings should not depend on arguments #699

Description

@eb8680

For example, the following is currently allowed, but really should trigger an error at Template definition time:

@Template.define
def is_even(x: int) -> bool:
    """
    Return ``True`` if x={x} is even, else ``False``

    >>> is_even({x} * 2)
    True
    """
    raise NotHandled

This is important in the context of #433 but it should be considered a bug regardless (cf #579). #694 has a fix and some tests that could be made into a standalone PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions