Skip to content

Commit 7b7c1cf

Browse files
fix: async get_delegated
1 parent 5804210 commit 7b7c1cf

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

bittensor/core/async_subtensor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
decode_account_id,
2828
DynamicInfo,
2929
)
30+
from bittensor.core.chain_data.delegate_info import DelegatedInfo
3031
from bittensor.core.chain_data.utils import decode_metadata
3132
from bittensor.core.config import Config
3233
from bittensor.core.errors import SubstrateRequestException
@@ -1219,7 +1220,7 @@ async def get_delegated(
12191220
if not result:
12201221
return []
12211222

1222-
return DelegateInfo.delegated_list_from_dicts(result)
1223+
return DelegatedInfo.list_from_dicts(result)
12231224

12241225
async def get_delegates(
12251226
self,

tests/unit_tests/test_async_subtensor.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,9 +1217,9 @@ async def test_get_delegated_no_block_hash_no_reuse(subtensor, mocker):
12171217
# Preps
12181218
fake_coldkey_ss58 = "fake_ss58_address"
12191219

1220-
mocked_delegated_list_from_dicts = mocker.Mock()
1221-
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
1222-
mocked_delegated_list_from_dicts
1220+
mocked_delegated_list_from_dicts = mocker.patch.object(
1221+
async_subtensor.DelegatedInfo,
1222+
"list_from_dicts",
12231223
)
12241224

12251225
# Call
@@ -1245,9 +1245,9 @@ async def test_get_delegated_with_block_hash(subtensor, mocker):
12451245
fake_coldkey_ss58 = "fake_ss58_address"
12461246
fake_block_hash = "fake_block_hash"
12471247

1248-
mocked_delegated_list_from_dicts = mocker.Mock()
1249-
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
1250-
mocked_delegated_list_from_dicts
1248+
mocked_delegated_list_from_dicts = mocker.patch.object(
1249+
async_subtensor.DelegatedInfo,
1250+
"list_from_dicts",
12511251
)
12521252

12531253
# Call
@@ -1275,9 +1275,9 @@ async def test_get_delegated_with_reuse_block(subtensor, mocker):
12751275
fake_coldkey_ss58 = "fake_ss58_address"
12761276
reuse_block = True
12771277

1278-
mocked_delegated_list_from_dicts = mocker.Mock()
1279-
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
1280-
mocked_delegated_list_from_dicts
1278+
mocked_delegated_list_from_dicts = mocker.patch.object(
1279+
async_subtensor.DelegatedInfo,
1280+
"list_from_dicts",
12811281
)
12821282

12831283
# Call

0 commit comments

Comments
 (0)