Skip to content

Conversation

viccie30
Copy link
Contributor

@viccie30 viccie30 commented Feb 2, 2025

Add follow_wrapped parameter to doctest.DocTestFinder.find to
unwrap objects before searching them for doctests.

Add functools.update_wrapper call to constructor of
functools.singledispatchmethod to let it be searched by doctest.


📚 Documentation preview 📚: https://cpython-previews--129579.org.readthedocs.build/

@picnixz
Copy link
Member

picnixz commented Feb 2, 2025

Is there a way to do it without applying update_wrapper? I'm not entirely sure that it can be applied in all situations and the omission was not something deliberate. If update_wrapper is needed, we may also have a dedicated issue for that as this may change runtime assumptions for downstream users, so more testing may be needed (independently of doctest itseff).

cc @serhiy-storchaka

@viccie30
Copy link
Contributor Author

viccie30 commented Feb 2, 2025

Is there a way to do it without applying update_wrapper? I'm not entirely sure that it can be applied in all situations and the omission was not something deliberate. If update_wrapper is needed, we may also have a dedicated issue for that as this may change runtime assumptions for downstream users, so more testing may be needed (independently of doctest itseff).

It might be possible by letting doctest use an object's __doc__ attribute always and setting that explicitly in the constructor of singledispatchmethod. Right now, doctest only collects docstrings from function-like and class objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants