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

Adjust test_wrapped_name_and_docs for Python 3.13 #619

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/test_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ def test_grad_and_aux():
def test_wrapped_name_and_docs():
def foo(x): pass
assert grad.__name__ == 'grad'
assert grad.__doc__.startswith("\n Returns a function which")
# Python 3.13: Compiler now strip indents from docstrings.
# https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes
assert grad.__doc__.startswith(tuple(
"\n{}Returns a function which".format(indent) for indent in (" ", "")
))
assert grad(foo, 1).__name__ == 'grad_of_foo_wrt_argnum_1'
assert grad(foo, 1).__doc__.startswith(" grad of function foo with")
Loading