annotate Lib/test/test_rotor.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 88dbfa2bb9dc
children 0ad15f30c8d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4825
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
1 import rotor
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
2
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
3 r = rotor.newrotor("you'll never guess this")
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
4 r = rotor.newrotor("you'll never guess this", 12)
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
5
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
6 A = 'spam and eggs'
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
7 B = 'cheese shop'
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
8
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
9 a = r.encrypt(A)
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
10 print a
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
11 b = r.encryptmore(B)
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
12 print b
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
13
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
14 A1 = r.decrypt(a)
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
15 print A1
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
16 if A1 <> A:
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
17 print 'decrypt failed'
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
18
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
19 B1 = r.decryptmore(b)
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
20 print B1
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
21 if B1 <> B:
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
22 print 'decryptmore failed'
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
23
4856
88dbfa2bb9dc <rotorobj>.setkey() now requires exactly one argument
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
24 try:
88dbfa2bb9dc <rotorobj>.setkey() now requires exactly one argument
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
25 r.setkey()
88dbfa2bb9dc <rotorobj>.setkey() now requires exactly one argument
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
26 except TypeError:
88dbfa2bb9dc <rotorobj>.setkey() now requires exactly one argument
Barry Warsaw <barry@python.org>
parents: 4825
diff changeset
27 pass
4825
b8a97ad5f7ce test_rotor.py: New test of the rotor module.
Barry Warsaw <barry@python.org>
parents:
diff changeset
28 r.setkey('you guessed it!')