mirror of
https://github.com/python/cpython.git
synced 2025-12-09 02:35:14 +00:00
Simple conversion to PyUnit.
This commit is contained in:
parent
d657303910
commit
5b811bee5d
1 changed files with 17 additions and 20 deletions
|
|
@ -1,25 +1,22 @@
|
||||||
#! /usr/bin/env python
|
"""Test script for the grp module."""
|
||||||
"""Test script for the grp module
|
|
||||||
Roger E. Masse
|
# XXX This really needs some work, but what are the expected invariants?
|
||||||
"""
|
|
||||||
|
|
||||||
import grp
|
import grp
|
||||||
from test_support import verbose
|
import test_support
|
||||||
|
import unittest
|
||||||
|
|
||||||
groups = grp.getgrall()
|
|
||||||
if verbose:
|
|
||||||
print 'Groups:'
|
|
||||||
for group in groups:
|
|
||||||
print group
|
|
||||||
|
|
||||||
if not groups:
|
class GroupDatabaseTestCase(unittest.TestCase):
|
||||||
if verbose:
|
|
||||||
print "Empty Group Database -- no further tests of grp module possible"
|
|
||||||
else:
|
|
||||||
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])
|
def setUp(self):
|
||||||
if verbose:
|
self.groups = grp.getgrall()
|
||||||
print 'Group Entry for group %s: %s' % (groups[0][0], group)
|
|
||||||
|
def test_getgrgid(self):
|
||||||
|
entry = grp.getgrgid(self.groups[0][2])
|
||||||
|
|
||||||
|
def test_getgrnam(self):
|
||||||
|
entry = grp.getgrnam(self.groups[0][0])
|
||||||
|
|
||||||
|
|
||||||
|
test_support.run_unittest(GroupDatabaseTestCase)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue