https://github.com/python/cpython/commit/55150a79cacbce44f50cea128c511782df0ab277
commit: 55150a79cacbce44f50cea128c511782df0ab277
branch: main
author: Semyon Moroz <donbar...@proton.me>
committer: hugovk <1324225+hug...@users.noreply.github.com>
date: 2025-03-30T14:19:38+03:00
summary:

gh-131178: Update help message for `timeit` CLI (#131326)

files:
M Lib/test/test_timeit.py
M Lib/timeit.py

diff --git a/Lib/test/test_timeit.py b/Lib/test/test_timeit.py
index 72a104fc1a6790..f5ae0a84eb3506 100644
--- a/Lib/test/test_timeit.py
+++ b/Lib/test/test_timeit.py
@@ -297,9 +297,7 @@ def test_main_negative_reps(self):
     @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'])
diff --git a/Lib/timeit.py b/Lib/timeit.py
index c106e0f67356da..e767f0187826df 100644
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -44,7 +44,6 @@
     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"
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to