示例#1
0
 def test_to_hex_uncompressed(self):
     string = data['pubkey_hex']['uncompressed']
     assert PublicKey.from_hex(string).to_hex() == string
示例#2
0
    def test_from_hex_uncompressed(self):
        pubkey = PublicKey.from_hex(data['pubkey_hex']['uncompressed'])

        assert pubkey.pair == data['pubkey_pair']
        assert pubkey.compressed is False
        assert pubkey.network is bitforge.networks.default
示例#3
0
 def test_from_hex_errors(self):
     with raises(PublicKey.InvalidHex): PublicKey.from_hex('a')
     with raises(PublicKey.InvalidHex): PublicKey.from_hex('a@')
示例#4
0
 def test_to_address_test_uncompress(self):
     pubkey = PublicKey.from_hex(data['pubkey_hex']['uncompressed'], bitforge.networks.testnet)
     assert pubkey.to_address().to_string() == data['address']['test_uncompressed']
示例#5
0
 def test_to_address_live_compress(self):
     pubkey = PublicKey.from_hex(data['pubkey_hex']['compressed'],
                                 bitforge.networks.livenet)
     assert pubkey.to_address().to_string(
     ) == data['address']['live_compressed']
示例#6
0
 def test_to_hex_uncompressed(self):
     string = data['pubkey_hex']['uncompressed']
     assert PublicKey.from_hex(string).to_hex() == string
示例#7
0
 def test_from_hex_errors(self):
     with raises(PublicKey.InvalidHex):
         PublicKey.from_hex('a')
     with raises(PublicKey.InvalidHex):
         PublicKey.from_hex('a@')
示例#8
0
    def test_from_hex_uncompressed(self):
        pubkey = PublicKey.from_hex(data['pubkey_hex']['uncompressed'])

        assert pubkey.pair == data['pubkey_pair']
        assert pubkey.compressed is False
        assert pubkey.network is bitforge.networks.default