def test_verify(self):
     for i in range(self.SUBTEST_COUNT):
         password = get_random_valid_password()
         mnemonic_phrase = get_random_valid_mnemonic_phrase()
         seed_trezor = self.trezor.to_seed(mnemonic_phrase, password)
         with self.subTest(i=i,
                           mnemonic_phrase=mnemonic_phrase,
                           seed=seed_trezor,
                           password=password):
             self.assertTrue(
                 verify(Mnemonic(mnemonic_phrase), Seed(seed_trezor),
                        password))
 def test_verify_invalid_arguments(self):
     # noinspection PyTypeChecker
     for test_mnemonic in self.TESTING_TYPES + ['some string', b'\xff']:
         with self.assertRaisesRegex(TypeError, 'argument `mnemonic` should be of type Mnemonic'):
             verify(test_mnemonic, VALID_SEED_TREZOR, VALID_PASSWORD_TREZOR)
     # noinspection PyTypeChecker
     for test_seed in self.TESTING_TYPES + ['some string']:
         with self.assertRaisesRegex(TypeError, 'argument `expected_seed` should be of type Seed'):
             verify(VALID_MNEMONIC_TREZOR, test_seed, VALID_PASSWORD_TREZOR)
     # noinspection PyTypeChecker
     for test_password in self.TESTING_TYPES + [b'\xff']:
         with self.assertRaisesRegex(TypeError, 'argument `seed_password` should be of type str'):
             verify(VALID_MNEMONIC_TREZOR, VALID_SEED_TREZOR, test_password)
 def test_verify_invalid_password_invalid_utf8(self):
     with self.assertRaises(UnicodeError):
         verify(VALID_MNEMONIC_TREZOR, VALID_SEED_TREZOR, INVALID_PASSWORD_INVALID_UTF8)
 def test_verify_invalid_password_too_long(self):
     password = '******' * 1024 * 1024  # 1 MB
     with self.assertRaises(ValueError):
         verify(VALID_MNEMONIC_TREZOR, VALID_SEED_TREZOR, password)
 def test_verify(self):
     for test_vector in TREZOR_TEST_VECTORS['english']:
         self.assertTrue(verify(Mnemonic(test_vector[1]), Seed(unhexlify(test_vector[2])), TREZOR_PASSWORD))