Skip to content

Commit dc7b89e

Browse files
More elegantly patch tests for Python 3.13 docstring cleaning
1 parent 85cd1c5 commit dc7b89e

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

parameterized/test.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ def _assert_docstring(self, expected_docstring, rstrip=False):
385385
actual_docstring = test_method.__doc__
386386
if rstrip:
387387
actual_docstring = actual_docstring.rstrip()
388+
if sys.version_info[:2] >= (3, 13):
389+
expected_docstring = inspect.cleandoc(expected_docstring)
388390
assert_equal(actual_docstring, expected_docstring)
389391

390392
@parameterized.expand([param("foo")],
@@ -408,16 +410,10 @@ def test_multiline_documentation(self, foo):
408410
"""Documentation.
409411
410412
More"""
411-
if sys.version_info[:2] < (3, 13):
412-
self._assert_docstring(
413-
"Documentation [with foo=%r].\n\n"
414-
" More" %(foo, )
415-
)
416-
else:
417-
self._assert_docstring(
418-
"Documentation [with foo=%r].\n\n"
419-
"More" %(foo, )
420-
)
413+
self._assert_docstring(
414+
"Documentation [with foo=%r].\n\n"
415+
" More" %(foo, )
416+
)
421417

422418
@parameterized.expand([param("foo")])
423419
def test_unicode_docstring(self, foo):

0 commit comments

Comments
 (0)