jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008811?usp=email )

Change subject: [tests] Update 
DeprecatorTestCase.test_deprecated_function_docstring
......................................................................

[tests] Update DeprecatorTestCase.test_deprecated_function_docstring

The multiline docstring behaviour was change in Python 3.13:
https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes

Add a new test mehtod test_deprecated_function_multiline_docstring to
take into accoutn that there is a difference.

Bug: T359069
Change-Id: I7aa1f53fc8612bfe6f40ad098d2dcbb6d3d74c80
---
M tests/tools_deprecate_tests.py
1 file changed, 29 insertions(+), 5 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/tools_deprecate_tests.py b/tests/tools_deprecate_tests.py
index 2cf1f87..c4024b1 100755
--- a/tests/tools_deprecate_tests.py
+++ b/tests/tools_deprecate_tests.py
@@ -19,7 +19,6 @@
     remove_last_args,
 )
 from tests.aspects import DeprecationTestCase
-from tests.utils import expected_failure_if


 @add_full_name
@@ -299,8 +298,6 @@
         self.assertOneDeprecationParts(__name__ + '.deprecated_func_instead',
                                        'baz')

-    # deprecated_func_docstring_arg2 fails with Python 3.13
-    @expected_failure_if(PYTHON_VERSION >= (3, 13))
     def test_deprecated_function_docstring(self):
         """Test @deprecated docstring modification."""
         testcases = [
@@ -315,13 +312,24 @@
              'this. Deprecated function.'),
             (deprecated_func_docstring_arg, 'Deprecated.\n\n'
              ':param foo: Foo. DEPRECATED.'),
-            (deprecated_func_docstring_arg2, '\n    DEPRECATED.\n\n'
-             '    :param foo: Foo. DEPRECATED.\n    '),
         ]
         for rv, doc in testcases:
             with self.subTest(function=rv.__name__):
                 self.assertEqual(rv.__doc__, doc)

+    def test_deprecated_function_multiline_docstring(self):
+        """Test @deprecated docstring modification on multiline docstring.
+
+        Python 3.13 strips the doc string, see
+        https://docs.python.org/3.13/whatsnew/3.13.html#other-language-changes
+        """
+        doc = '\n    DEPRECATED.\n\n    :param foo: Foo. DEPRECATED.\n    '
+        if PYTHON_VERSION < (3, 13):
+            self.assertEqual(deprecated_func_docstring_arg2.__doc__, doc)
+        else:
+            self.assertEqual(deprecated_func_docstring_arg2.__doc__,
+                             doc.replace(' ' * 4, ''))
+
     def test_deprecated_function_bad_args(self):
         """Test @deprecated function with bad arguments."""
         rv = deprecated_func_bad_args(None)

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1008811?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I7aa1f53fc8612bfe6f40ad098d2dcbb6d3d74c80
Gerrit-Change-Number: 1008811
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to