|
rdobuilder |
8f5ab9 |
From 85cd1c5e0b95a75385e68972ceef3329edb7b7f0 Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
8f5ab9 |
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
|
rdobuilder |
8f5ab9 |
Date: Mon, 30 Oct 2023 10:38:27 -0400
|
|
rdobuilder |
8f5ab9 |
Subject: [PATCH 1/2] Fix tests to handle Python 3.13 stripping indents from
|
|
rdobuilder |
8f5ab9 |
docstrings
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
https://github.com/python/cpython/issues/81283
|
|
rdobuilder |
8f5ab9 |
---
|
|
rdobuilder |
8f5ab9 |
parameterized/test.py | 14 ++++++++++----
|
|
rdobuilder |
8f5ab9 |
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
diff --git a/parameterized/test.py b/parameterized/test.py
|
|
rdobuilder |
8f5ab9 |
index 6c71f79..6419171 100644
|
|
rdobuilder |
8f5ab9 |
--- a/parameterized/test.py
|
|
rdobuilder |
8f5ab9 |
+++ b/parameterized/test.py
|
|
rdobuilder |
8f5ab9 |
@@ -408,10 +408,16 @@ def test_multiline_documentation(self, foo):
|
|
rdobuilder |
8f5ab9 |
"""Documentation.
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
More"""
|
|
rdobuilder |
8f5ab9 |
- self._assert_docstring(
|
|
rdobuilder |
8f5ab9 |
- "Documentation [with foo=%r].\n\n"
|
|
rdobuilder |
8f5ab9 |
- " More" %(foo, )
|
|
rdobuilder |
8f5ab9 |
- )
|
|
rdobuilder |
8f5ab9 |
+ if sys.version_info[:2] < (3, 13):
|
|
rdobuilder |
8f5ab9 |
+ self._assert_docstring(
|
|
rdobuilder |
8f5ab9 |
+ "Documentation [with foo=%r].\n\n"
|
|
rdobuilder |
8f5ab9 |
+ " More" %(foo, )
|
|
rdobuilder |
8f5ab9 |
+ )
|
|
rdobuilder |
8f5ab9 |
+ else:
|
|
rdobuilder |
8f5ab9 |
+ self._assert_docstring(
|
|
rdobuilder |
8f5ab9 |
+ "Documentation [with foo=%r].\n\n"
|
|
rdobuilder |
8f5ab9 |
+ "More" %(foo, )
|
|
rdobuilder |
8f5ab9 |
+ )
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
@parameterized.expand([param("foo")])
|
|
rdobuilder |
8f5ab9 |
def test_unicode_docstring(self, foo):
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
From dc7b89e9c995137219f3e53f5314824c4a0b914f Mon Sep 17 00:00:00 2001
|
|
rdobuilder |
8f5ab9 |
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
|
rdobuilder |
8f5ab9 |
Date: Mon, 30 Oct 2023 10:49:25 -0400
|
|
rdobuilder |
8f5ab9 |
Subject: [PATCH 2/2] More elegantly patch tests for Python 3.13 docstring
|
|
rdobuilder |
8f5ab9 |
cleaning
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
---
|
|
rdobuilder |
8f5ab9 |
parameterized/test.py | 16 ++++++----------
|
|
rdobuilder |
8f5ab9 |
1 file changed, 6 insertions(+), 10 deletions(-)
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
diff --git a/parameterized/test.py b/parameterized/test.py
|
|
rdobuilder |
8f5ab9 |
index 6419171..6d11e32 100644
|
|
rdobuilder |
8f5ab9 |
--- a/parameterized/test.py
|
|
rdobuilder |
8f5ab9 |
+++ b/parameterized/test.py
|
|
rdobuilder |
8f5ab9 |
@@ -385,6 +385,8 @@ def _assert_docstring(self, expected_docstring, rstrip=False):
|
|
rdobuilder |
8f5ab9 |
actual_docstring = test_method.__doc__
|
|
rdobuilder |
8f5ab9 |
if rstrip:
|
|
rdobuilder |
8f5ab9 |
actual_docstring = actual_docstring.rstrip()
|
|
rdobuilder |
8f5ab9 |
+ if sys.version_info[:2] >= (3, 13):
|
|
rdobuilder |
8f5ab9 |
+ expected_docstring = inspect.cleandoc(expected_docstring)
|
|
rdobuilder |
8f5ab9 |
assert_equal(actual_docstring, expected_docstring)
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
@parameterized.expand([param("foo")],
|
|
rdobuilder |
8f5ab9 |
@@ -408,16 +410,10 @@ def test_multiline_documentation(self, foo):
|
|
rdobuilder |
8f5ab9 |
"""Documentation.
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
More"""
|
|
rdobuilder |
8f5ab9 |
- if sys.version_info[:2] < (3, 13):
|
|
rdobuilder |
8f5ab9 |
- self._assert_docstring(
|
|
rdobuilder |
8f5ab9 |
- "Documentation [with foo=%r].\n\n"
|
|
rdobuilder |
8f5ab9 |
- " More" %(foo, )
|
|
rdobuilder |
8f5ab9 |
- )
|
|
rdobuilder |
8f5ab9 |
- else:
|
|
rdobuilder |
8f5ab9 |
- self._assert_docstring(
|
|
rdobuilder |
8f5ab9 |
- "Documentation [with foo=%r].\n\n"
|
|
rdobuilder |
8f5ab9 |
- "More" %(foo, )
|
|
rdobuilder |
8f5ab9 |
- )
|
|
rdobuilder |
8f5ab9 |
+ self._assert_docstring(
|
|
rdobuilder |
8f5ab9 |
+ "Documentation [with foo=%r].\n\n"
|
|
rdobuilder |
8f5ab9 |
+ " More" %(foo, )
|
|
rdobuilder |
8f5ab9 |
+ )
|
|
rdobuilder |
8f5ab9 |
|
|
rdobuilder |
8f5ab9 |
@parameterized.expand([param("foo")])
|
|
rdobuilder |
8f5ab9 |
def test_unicode_docstring(self, foo):
|