def __init__(self, key, ocrasuite_description, remote_ocrasuite_description=None): self.key = key self.ocrasuite = str2ocrasuite(ocrasuite_description) self.remote_ocrasuite = remote_ocrasuite_description is not None \ and str2ocrasuite(remote_ocrasuite_description) if not self.ocrasuite.data_input.Q: raise ValueError, ('Ocrasuite must have a Q descriptor',)
def test_str2ocrasuite(self): for test in self.tests: ocrasuite = str2ocrasuite(test['ocrasuite']) key = test['key'] for vector in test['vectors']: params = vector['params'] result = vector['result'] if ocrasuite.data_input.P: params['P'] = self.pin self.assertEqual(ocrasuite(key, **params), result)