PyXR

c:\python24\lib \ test \ test_nis.py



0001 from test.test_support import verbose, TestFailed, TestSkipped
0002 import nis
0003 
0004 print 'nis.maps()'
0005 try:
0006     maps = nis.maps()
0007 except nis.error, msg:
0008     # NIS is probably not active, so this test isn't useful
0009     if verbose:
0010         raise TestFailed, msg
0011     # only do this if running under the regression suite
0012     raise TestSkipped, msg
0013 
0014 done = 0
0015 for nismap in maps:
0016     if verbose:
0017         print nismap
0018     mapping = nis.cat(nismap)
0019     for k, v in mapping.items():
0020         if verbose:
0021             print '    ', k, v
0022         if not k:
0023             continue
0024         if nis.match(k, nismap) != v:
0025             print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
0026         else:
0027             # just test the one key, otherwise this test could take a
0028             # very long time
0029             done = 1
0030             break
0031     if done:
0032         break
0033 

Generated by PyXR 0.9.4
SourceForge.net Logo