diff options
author | Fred Drake <fdrake@acm.org> | 2001-05-18 21:38:52 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-05-18 21:38:52 (GMT) |
commit | 5b811bee5ddb1d0c3ea5d90f430a1f0e462246aa (patch) | |
tree | 365c337ef15869ae3c267ce50c40c80ec0c805fb | |
parent | d657303910244aea88c192f5629d5fe9ea778a6d (diff) | |
download | cpython-5b811bee5ddb1d0c3ea5d90f430a1f0e462246aa.zip cpython-5b811bee5ddb1d0c3ea5d90f430a1f0e462246aa.tar.gz cpython-5b811bee5ddb1d0c3ea5d90f430a1f0e462246aa.tar.bz2 |
Simple conversion to PyUnit.
-rwxr-xr-x | Lib/test/test_grp.py | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/Lib/test/test_grp.py b/Lib/test/test_grp.py index b737da9..1edb417 100755 --- a/Lib/test/test_grp.py +++ b/Lib/test/test_grp.py @@ -1,25 +1,22 @@ -#! /usr/bin/env python -"""Test script for the grp module - Roger E. Masse -""" +"""Test script for the grp module.""" + +# XXX This really needs some work, but what are the expected invariants? import grp -from test_support import verbose - -groups = grp.getgrall() -if verbose: - print 'Groups:' - for group in groups: - print group - -if not groups: - 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]) - if verbose: - print 'Group Entry for group %s: %s' % (groups[0][0], group) +import test_support +import unittest + + +class GroupDatabaseTestCase(unittest.TestCase): + + def setUp(self): + self.groups = grp.getgrall() + + 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) |