]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simple conversion to PyUnit.
authorFred Drake <fdrake@acm.org>
Fri, 18 May 2001 21:38:52 +0000 (21:38 +0000)
committerFred Drake <fdrake@acm.org>
Fri, 18 May 2001 21:38:52 +0000 (21:38 +0000)
Lib/test/test_grp.py

index b737da97287a46c96c2c5da9efff45da026ad7f3..1edb4173d4f5051a3b9c1e47c45a79971edbcb0c 100755 (executable)
@@ -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)