コード例 #1
0
 def test_bech32_validation(self):
     btc = BitcoinBlockchain()
     result = btc.validate(
         'an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs'
     )
     self.assertIsInstance(result, ValidationResult)
     self.assertTrue(result.has_checksum())
コード例 #2
0
 def validator(self):
     return Bech32Validator(BitcoinBlockchain())
コード例 #3
0
 def test_bech32_address_from_test_net(self):
     btc = BitcoinBlockchain()
     result = btc.validate('tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx')
     self.assertEqual(result.network_name(), BitcoinBlockchain.TEST_NET)
     self.assertFalse(result.is_from_main_net())
コード例 #4
0
 def test_bech32_address_from_main_net(self):
     btc = BitcoinBlockchain()
     result = btc.validate('bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4')
     self.assertEqual(result.network_name(), BitcoinBlockchain.MAIN_NET)
     self.assertTrue(result.is_from_main_net())
コード例 #5
0
 def test_is_valid_failure(self):
     btc = BitcoinBlockchain()
     result, details = btc.is_valid('lorem ipsum')
     self.assertFalse(result)
     self.assertIsInstance(details, FailedValidation)
コード例 #6
0
 def test_is_valid_success(self):
     btc = BitcoinBlockchain()
     result, details = btc.is_valid('1MmErJTQpfs5dHC1bTLpGqFM34MqXCaC5r')
     self.assertTrue(result)
     self.assertIsInstance(details, ValidationResult)
コード例 #7
0
 def test_base58check_validation(self):
     btc = BitcoinBlockchain()
     result = btc.validate('1MmErJTQpfs5dHC1bTLpGqFM34MqXCaC5r')
     self.assertIsInstance(result, ValidationResult)
     self.assertTrue(result.has_checksum())
コード例 #8
0
 def validator(self):
     return Base58CheckValidator(BitcoinBlockchain())