SomberNight
7 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
20 additions and
12 deletions
-
lib/tests/__init__.py
-
lib/tests/test_bitcoin.py
|
@ -0,0 +1,16 @@ |
|
|
|
|
|
import unittest |
|
|
|
|
|
|
|
|
|
|
|
from lib import constants |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestCaseForTestnet(unittest.TestCase): |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
def setUpClass(cls): |
|
|
|
|
|
super().setUpClass() |
|
|
|
|
|
constants.set_testnet() |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
def tearDownClass(cls): |
|
|
|
|
|
super().tearDownClass() |
|
|
|
|
|
constants.set_mainnet() |
|
@ -13,7 +13,9 @@ from lib.bitcoin import ( |
|
|
is_b58_address, address_to_scripthash, is_minikey, is_compressed, is_xpub, |
|
|
is_b58_address, address_to_scripthash, is_minikey, is_compressed, is_xpub, |
|
|
xpub_type, is_xprv, is_bip32_derivation, seed_type) |
|
|
xpub_type, is_xprv, is_bip32_derivation, seed_type) |
|
|
from lib.util import bfh |
|
|
from lib.util import bfh |
|
|
from lib import constants |
|
|
|
|
|
|
|
|
from . import TestCaseForTestnet |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
import ecdsa |
|
|
import ecdsa |
|
@ -164,17 +166,7 @@ class Test_bitcoin(unittest.TestCase): |
|
|
self.assertEqual(address_to_script('3PyjzJ3im7f7bcV724GR57edKDqoZvH7Ji'), 'a914f47c8954e421031ad04ecd8e7752c9479206b9d387') |
|
|
self.assertEqual(address_to_script('3PyjzJ3im7f7bcV724GR57edKDqoZvH7Ji'), 'a914f47c8954e421031ad04ecd8e7752c9479206b9d387') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Test_bitcoin_testnet(unittest.TestCase): |
|
|
class Test_bitcoin_testnet(TestCaseForTestnet): |
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
def setUpClass(cls): |
|
|
|
|
|
super().setUpClass() |
|
|
|
|
|
constants.set_testnet() |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
def tearDownClass(cls): |
|
|
|
|
|
super().tearDownClass() |
|
|
|
|
|
constants.set_mainnet() |
|
|
|
|
|
|
|
|
|
|
|
def test_address_to_script(self): |
|
|
def test_address_to_script(self): |
|
|
# bech32 native segwit |
|
|
# bech32 native segwit |
|
|