Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broken by single line docstrings #20

Open
samuelcolvin opened this issue Sep 21, 2023 · 1 comment · May be fixed by #21
Open

broken by single line docstrings #20

samuelcolvin opened this issue Sep 21, 2023 · 1 comment · May be fixed by #21

Comments

@samuelcolvin
Copy link
Member

pytest-examples gets very messed up by single line docstrings, and starts finding the python code between docstrings, not the docstrings.

This results in examples being missed.

@samuelcolvin
Copy link
Member Author

For example this code means pytest-examples doesn't find examples later in the file:

def _getattr_no_parents(obj: Any, attribute: str) -> Any:
    """Returns the attribute value without attempting to look up attributes from parent types."""
    if hasattr(obj, '__dict__'):
        try:
            return obj.__dict__[attribute]
        except KeyError:
            pass

From pydantic/type_adapter.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant