mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #26129: Deprecated accepting non-integers in grp.getgrgid().
This commit is contained in:
parent
9def284387
commit
9cc4ed5c7a
4 changed files with 31 additions and 5 deletions
|
@ -92,5 +92,15 @@ class GroupDatabaseTestCase(unittest.TestCase):
|
|||
|
||||
self.assertRaises(KeyError, grp.getgrgid, fakegid)
|
||||
|
||||
def test_noninteger_gid(self):
|
||||
entries = grp.getgrall()
|
||||
if not entries:
|
||||
self.skipTest('no groups')
|
||||
# Choose an existent gid.
|
||||
gid = entries[0][2]
|
||||
self.assertWarns(DeprecationWarning, grp.getgrgid, float(gid))
|
||||
self.assertWarns(DeprecationWarning, grp.getgrgid, str(gid))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue