Maintain backwards compatibility with python < 2.3 by dynamically
[python/dscho.git] / Lib / test / test_rotor.py
blobeeec55a7a4e9c19206df13c7e59a43673b49269a
1 import warnings
3 warnings.filterwarnings("ignore",
4 category=DeprecationWarning,
5 message='.*is deprecated', module=__name__)
7 import rotor
9 r = rotor.newrotor("you'll never guess this")
10 r = rotor.newrotor("you'll never guess this", 12)
12 A = 'spam and eggs'
13 B = 'cheese shop'
15 a = r.encrypt(A)
16 print `a`
17 b = r.encryptmore(B)
18 print `b`
20 A1 = r.decrypt(a)
21 print A1
22 if A1 != A:
23 print 'decrypt failed'
25 B1 = r.decryptmore(b)
26 print B1
27 if B1 != B:
28 print 'decryptmore failed'
30 try:
31 r.setkey()
32 except TypeError:
33 pass
34 r.setkey('you guessed it!')