[Python-checkins] gh-95395: Add argument type error test (GH-95412) (GH-95745)

ambv webhook-mailer at python.org
Sat Aug 6 13:30:33 EDT 2022


https://github.com/python/cpython/commit/9278fc4e27d7b4bad03cb0976fff80828b149ed2
commit: 9278fc4e27d7b4bad03cb0976fff80828b149ed2
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2022-08-06T19:30:29+02:00
summary:

gh-95395: Add argument type error test (GH-95412) (GH-95745)

(cherry picked from commit 4703c158116bd157e20938bbf5356b79422470bb)

Co-authored-by: Sion Kang <31057849+Yaminyam at users.noreply.github.com>

files:
M Lib/test/test_grp.py

diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py
index c7ec03ec0e4..e52e17b8dc7 100644
--- a/Lib/test/test_grp.py
+++ b/Lib/test/test_grp.py
@@ -49,10 +49,12 @@ def test_values_extended(self):
 
     def test_errors(self):
         self.assertRaises(TypeError, grp.getgrgid)
+        self.assertRaises(TypeError, grp.getgrgid, 3.14)
         self.assertRaises(TypeError, grp.getgrnam)
+        self.assertRaises(TypeError, grp.getgrnam, 42)
         self.assertRaises(TypeError, grp.getgrall, 42)
         # embedded null character
-        self.assertRaises(ValueError, grp.getgrnam, 'a\x00b')
+        self.assertRaisesRegex(ValueError, 'null', grp.getgrnam, 'a\x00b')
 
         # try to get some errors
         bynames = {}



More information about the Python-checkins mailing list