https://github.com/python/cpython/commit/b51ecd89c63ba5217b555e97953fb71933ce47d4
commit: b51ecd89c63ba5217b555e97953fb71933ce47d4
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: tomasr8 <[email protected]>
date: 2026-07-19T09:09:28Z
summary:

[3.15] Add test coverage to check execution of GetoptError.__str__ (GH-153941) 
(#153997)

Add test coverage to check execution of GetoptError.__str__ (GH-153941)

* Increase test coverage of getopt to check execution of GetoptError.__str__

* Add test coverage to check execution of GetoptError.__str__

* Add test coverage to check execution of GetoptError.__str__

* Add test coverage to check execution of GetoptError.__str__

* Add test coverage to check execution of GetoptError.__str__

* Add test coverage to check execution of GetoptError.__str__
(cherry picked from commit 9adef68a7956744b804d09c8b8b06c8c171053e5)

Co-authored-by: Manith Hettiarachchilage <[email protected]>

files:
M Lib/test/test_getopt.py

diff --git a/Lib/test/test_getopt.py b/Lib/test/test_getopt.py
index 8b6c3b8baa07c5..fac2ca3db81d70 100644
--- a/Lib/test/test_getopt.py
+++ b/Lib/test/test_getopt.py
@@ -229,6 +229,10 @@ def test_issue4629(self):
         self.assertEqual(longopts, [('--help', 'x')])
         self.assertRaises(getopt.GetoptError, getopt.getopt, ['--help='], '', 
['help'])
 
+    def test_getopt_error_str(self):
+        error  = getopt.GetoptError('option -a not recognized', 'a')
+        self.assertEqual(str(error), 'option -a not recognized')
+
 def test_libref_examples():
     """
     Examples from the Library Reference:  Doc/lib/libgetopt.tex

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to