def test_init_wif_error(self): with pytest.raises(TypeError): BaseKey(b'\x00')
def test_public_key_compressed(self): base_key = BaseKey(WALLET_FORMAT_COMPRESSED_MAIN) assert base_key.public_key == PUBLIC_KEY_COMPRESSED
def test_init_from_key(self): pk = ECPrivateKey() base_key = BaseKey(pk) assert base_key._pk == pk
def test_init_default(self): base_key = BaseKey() assert isinstance(base_key._pk, ECPrivateKey) assert len(base_key.public_key) == 33
def test_equal(self): assert BaseKey(WALLET_FORMAT_COMPRESSED_MAIN) == BaseKey( WALLET_FORMAT_COMPRESSED_MAIN)
def test_is_compressed(self): assert BaseKey(WALLET_FORMAT_COMPRESSED_MAIN).is_compressed() is True assert BaseKey(WALLET_FORMAT_MAIN).is_compressed() is False
def test_to_int(self): base_key = BaseKey(WALLET_FORMAT_MAIN) assert base_key.to_int() == PRIVATE_KEY_NUM