[Python-checkins] CVS: python/dist/src/Lib/test test_grp.py,1.7,1.8
Fred L. Drake
fdrake@users.sourceforge.net
Fri, 18 May 2001 14:38:54 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv16387
Modified Files:
test_grp.py
Log Message:
Simple conversion to PyUnit.
Index: test_grp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** test_grp.py 2001/01/17 21:51:35 1.7
--- test_grp.py 2001/05/18 21:38:52 1.8
***************
*** 1,25 ****
! #! /usr/bin/env python
! """Test script for the grp module
! Roger E. Masse
! """
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)
--- 1,22 ----
! """Test script for the grp module."""
+ # XXX This really needs some work, but what are the expected invariants?
+
import grp
! 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)