18
18
import unittest
19
19
from unittest .mock import MagicMock , patch
20
20
21
- from substrateinterface import Keypair
21
+ import pytest
22
+ from bittensor_wallet import Keypair
22
23
23
24
import bittensor
24
25
from bittensor .core import settings
26
+ from bittensor .core .extrinsics import transfer
25
27
from bittensor .utils .balance import Balance
26
28
from bittensor .utils .mock import MockSubtensor
27
29
from tests .helpers import (
30
32
get_mock_keypair ,
31
33
get_mock_wallet ,
32
34
)
33
- from bittensor .core .extrinsics import transfer
34
35
35
36
36
37
class TestSubtensor (unittest .TestCase ):
@@ -171,7 +172,7 @@ def test_transfer_invalid_dest(self):
171
172
)
172
173
self .assertFalse (fail , msg = "Transfer should fail because of invalid dest" )
173
174
174
- def test_transfer_dest_as_bytes (self ):
175
+ def test_transfer_dest_as_bytes_fails (self ):
175
176
fake_coldkey = get_mock_coldkey (1 )
176
177
with patch (
177
178
"bittensor.core.extrinsics.transfer.do_transfer" ,
@@ -183,13 +184,14 @@ def test_transfer_dest_as_bytes(self):
183
184
self .subtensor .get_balance = MagicMock (return_value = self .balance )
184
185
185
186
dest_as_bytes : bytes = Keypair (fake_coldkey ).public_key
186
- success = self .subtensor .transfer (
187
- self .wallet ,
188
- dest_as_bytes , # invalid dest
189
- amount = 200 ,
190
- wait_for_inclusion = True ,
191
- )
192
- self .assertTrue (success , msg = "Transfer should succeed" )
187
+
188
+ with pytest .raises (TypeError ):
189
+ self .subtensor .transfer (
190
+ self .wallet ,
191
+ dest_as_bytes , # invalid dest
192
+ amount = 200 ,
193
+ wait_for_inclusion = True ,
194
+ )
193
195
194
196
def test_set_weights (self ):
195
197
chain_weights = [0 ]
0 commit comments