annotate Lib/test/test_nis.py @ 5817:48b94de85bf3 legacy-trunk

Extensive changes by AMK.
author Guido van Rossum <guido@python.org>
date Thu, 17 Jul 1997 16:29:42 +0000
parents 826f28985bea
children aedd2d0dcb31
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5533
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
1 from test_support import verbose, TestFailed
4678
1592970c789b test of the nis module
Barry Warsaw <barry@python.org>
parents:
diff changeset
2 import nis
1592970c789b test of the nis module
Barry Warsaw <barry@python.org>
parents:
diff changeset
3
4825
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents: 4680
diff changeset
4 print 'nis.maps()'
5533
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
5 try:
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
6 # the following could fail if NIS isn't active
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
7 maps = nis.maps()
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
8 except nis.error, msg:
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
9 raise TestFailed, msg
826f28985bea Catch nis.error and raise TestFailed instead. This catches the
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
10
4680
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
11 done = 0
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
12 for nismap in maps:
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
13 if verbose:
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
14 print nismap
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
15 mapping = nis.cat(nismap)
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
16 for k, v in mapping.items():
4678
1592970c789b test of the nis module
Barry Warsaw <barry@python.org>
parents:
diff changeset
17 if verbose:
4680
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
18 print ' ', k, v
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
19 if not k:
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
20 continue
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
21 if nis.match(k, nismap) <> v:
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
22 print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
23 else:
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
24 # just test the one key, otherwise this test could take a
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
25 # very long time
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
26 done = 1
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
27 break
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
28 if done:
10c1b8f3902f Rewrite without using try-except to break out of two loops.
Guido van Rossum <guido@python.org>
parents: 4679
diff changeset
29 break