]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-131178: Update help message for `timeit` CLI (#131326)
authorSemyon Moroz <donbarbos@proton.me>
Sun, 30 Mar 2025 11:19:38 +0000 (15:19 +0400)
committerGitHub <noreply@github.com>
Sun, 30 Mar 2025 11:19:38 +0000 (14:19 +0300)
Lib/test/test_timeit.py
Lib/timeit.py

index 72a104fc1a6790d668e2fb78e1339837351a7b81..f5ae0a84eb3506cd3c425cc1245199ad608b8fe0 100644 (file)
@@ -297,9 +297,7 @@ class TestTimeit(unittest.TestCase):
     @unittest.skipIf(sys.flags.optimize >= 2, "need __doc__")
     def test_main_help(self):
         s = self.run_main(switches=['-h'])
-        # Note: It's not clear that the trailing space was intended as part of
-        # the help text, but since it's there, check for it.
-        self.assertEqual(s, timeit.__doc__ + ' ')
+        self.assertEqual(s, timeit.__doc__)
 
     def test_main_verbose(self):
         s = self.run_main(switches=['-v'])
index c106e0f67356da1d549f175588d070db5b892eab..e767f0187826df652bf4ca7c45a0eb13265f5657 100644 (file)
@@ -44,7 +44,6 @@ Functions:
     timeit(string, string) -> float
     repeat(string, string) -> list
     default_timer() -> float
-
 """
 
 import gc
@@ -302,7 +301,7 @@ def main(args=None, *, _wrap_timer=None):
                 precision += 1
             verbose += 1
         if o in ("-h", "--help"):
-            print(__doc__, end=' ')
+            print(__doc__, end="")
             return 0
     setup = "\n".join(setup) or "pass"