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

This commit is contained in:
Sion Kang 2022-08-07 01:52:53 +09:00 committed by GitHub
parent d25ff1f613
commit 4703c15811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,10 +49,12 @@ class GroupDatabaseTestCase(unittest.TestCase):
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 = {}