Skip to content

Commit

Permalink
Adjust test_wrapped_name_and_docs for Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
musicinmybrain committed Apr 27, 2024
1 parent 9a90bd6 commit 210f77d
Showing 1 changed file with 5 additions and 1 deletion.
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")

0 comments on commit 210f77d

Please sign in to comment.