mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Test script for the UNIX group file access module (grp)
This commit is contained in:
parent
f90eddef5d
commit
749cc6b241
2 changed files with 25 additions and 0 deletions
24
Lib/test/test_grp.py
Executable file
24
Lib/test/test_grp.py
Executable file
|
@ -0,0 +1,24 @@
|
|||
#! /usr/bin/env python
|
||||
"""Test script for the grp module
|
||||
Roger E. Masse
|
||||
"""
|
||||
verbose = 0
|
||||
if __name__ == '__main__':
|
||||
verbose = 1
|
||||
|
||||
import grp
|
||||
|
||||
groups = grp.getgrall()
|
||||
if verbose:
|
||||
print 'Groups:'
|
||||
for group in groups:
|
||||
print group
|
||||
|
||||
|
||||
group = grp.getgrgid(groups[0][2])
|
||||
if verbose:
|
||||
print 'Group Entry for GID %d: %s' % (groups[0][2], group)
|
||||
|
||||
group = grp.getgrnam(groups[0][0])
|
||||
if verbose:
|
||||
print 'Group Entry for group %s: %s' % (groups[0][0], group)
|
Loading…
Add table
Add a link
Reference in a new issue