From 210f77d9a6aa5008345bf592f88a2a939efd08f3 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 27 Apr 2024 10:08:20 -0400 Subject: [PATCH] Adjust test_wrapped_name_and_docs for Python 3.13 --- tests/test_wrappers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_wrappers.py b/tests/test_wrappers.py index 2242771a..97de3d55 100644 --- a/tests/test_wrappers.py +++ b/tests/test_wrappers.py @@ -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")