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

ambv webhook-mailer at python.org
Sat Aug 6 12:52:57 EDT 2022


https://github.com/python/cpython/commit/4703c158116bd157e20938bbf5356b79422470bb
commit: 4703c158116bd157e20938bbf5356b79422470bb
branch: main
author: Sion Kang <31057849+Yaminyam at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2022-08-06T18:52:53+02:00
summary:

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

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