[PATCH 4 of 8] tests: pass re.MULTILINE to re.sub as 'flags' - not in 'count' position

Mads Kiilerich mads at kiilerich.com
Fri Jul 26 19:42:21 UTC 2024


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1705006735 -3600
#      Thu Jan 11 21:58:55 2024 +0100
# Node ID c625a18c3a3de93cf9750f23a496664c653a353d
# Parent  ff25ec7c3af036cdb39ac141e7b6e778611fbf34
tests: pass re.MULTILINE to re.sub as 'flags' - not in 'count' position

This bug was caught by the new Python 3.13 warning:

  DeprecationWarning: 'count' is passed as positional argument

diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -21,9 +21,9 @@ class py3docchecker(doctest.OutputChecke
             r'''^mercurial\.\w+\.(\w+): (['"])(.*?)\2''',
             r'\1: \3',
             got2,
-            re.MULTILINE,
+            flags=re.MULTILINE,
         )
-        got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE)
+        got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, flags=re.MULTILINE)
         return any(
             doctest.OutputChecker.check_output(self, w, g, optionflags)
             for w, g in [(want, got), (want2, got2)]



More information about the Mercurial-devel mailing list