MCPcopy Create free account
hub / github.com/ActiveState/code / main

Function main

recipes/Python/576598_Utility_Mill_Test/recipe-576598.py:85–138  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83# END
84
85def main():
86 try:
87 while True:
88 print('Testing', end=' ')
89 choice = random.randrange(3)
90 if choice == 1:
91 # Test "Create Keys" Action
92 print('Create', end=' ')
93 choice = random.randrange(4)
94 if choice == 1:
95 # Test No Names
96 print('No Names', end=' ... ')
97 test_create()
98 elif choice == 2:
99 # Test Major Name
100 print('Major Name', end=' ... ')
101 n1 = verse()
102 major, minor = test_create(MAJOR_NAME=n1)
103 assert major == spice.named_major(n1)
104 elif choice == 3:
105 # Test Minor Name
106 print('Minor Name', end=' ... ')
107 n2 = verse()
108 major, minor = test_create(MINOR_NAME=n2)
109 assert minor == spice.named_minor(n2)
110 else:
111 # Test Both Names
112 print('Both Names', end=' ... ')
113 n1, n2 = verse(), verse()
114 major, minor = test_create(MAJOR_NAME=n1, MINOR_NAME=n2)
115 assert major == spice.named_major(n1)
116 assert minor == spice.named_minor(n2)
117 elif choice == 2:
118 # Test "Encode Input" Action
119 print('Encode', end=' ... ')
120 major = spice.crypt_major()
121 minor = spice.crypt_minor()
122 data = verse()
123 encoded = test_encode(major, minor, data)
124 decoded = spice.decode_string(encoded, major, minor)
125 assert decoded == data
126 else:
127 # Test "Decode Input" Action
128 print('Decode', end=' ... ')
129 major = spice.crypt_major()
130 minor = spice.crypt_minor()
131 data = verse()
132 encoded = spice.encode_string(data, major, minor)
133 decoded = test_decode(major, minor, encoded)
134 assert decoded == data
135 print('PASS')
136 time.sleep(60)
137 except:
138 print('FAIL')
139
140def test_create(**query):
141 output = test_latest('SPICE_Text', ACTION='Create Keys', **query)

Callers 1

recipe-576598.pyFile · 0.70

Calls 6

printFunction · 0.85
test_createFunction · 0.85
verseFunction · 0.85
test_encodeFunction · 0.85
test_decodeFunction · 0.85
sleepMethod · 0.45

Tested by

no test coverage detected