Skip to content

Commit 02ea729

Browse files
authored
Merge pull request #2706 from opentensor/fix/zyzniewski/async_get_delegated
fix: async get_delegated
2 parents a88e2d7 + 61c8c70 commit 02ea729

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
@@ -28,6 +28,7 @@
2828
decode_account_id,
2929
DynamicInfo,
3030
)
31+
from bittensor.core.chain_data.delegate_info import DelegatedInfo
3132
from bittensor.core.chain_data.utils import decode_metadata
3233
from bittensor.core.config import Config
3334
from bittensor.core.errors import SubstrateRequestException
@@ -1220,7 +1221,7 @@ async def get_delegated(
12201221
if not result:
12211222
return []
12221223

1223-
return DelegateInfo.delegated_list_from_dicts(result)
1224+
return DelegatedInfo.list_from_dicts(result)
12241225

12251226
async def get_delegates(
12261227
self,

tests/unit_tests/test_async_subtensor.py

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

1222-
mocked_delegated_list_from_dicts = mocker.Mock()
1223-
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
1224-
mocked_delegated_list_from_dicts
1222+
mocked_delegated_list_from_dicts = mocker.patch.object(
1223+
async_subtensor.DelegatedInfo,
1224+
"list_from_dicts",
12251225
)
12261226

12271227
# Call
@@ -1247,9 +1247,9 @@ async def test_get_delegated_with_block_hash(subtensor, mocker):
12471247
fake_coldkey_ss58 = "fake_ss58_address"
12481248
fake_block_hash = "fake_block_hash"
12491249

1250-
mocked_delegated_list_from_dicts = mocker.Mock()
1251-
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
1252-
mocked_delegated_list_from_dicts
1250+
mocked_delegated_list_from_dicts = mocker.patch.object(
1251+
async_subtensor.DelegatedInfo,
1252+
"list_from_dicts",
12531253
)
12541254

12551255
# Call
@@ -1277,9 +1277,9 @@ async def test_get_delegated_with_reuse_block(subtensor, mocker):
12771277
fake_coldkey_ss58 = "fake_ss58_address"
12781278
reuse_block = True
12791279

1280-
mocked_delegated_list_from_dicts = mocker.Mock()
1281-
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
1282-
mocked_delegated_list_from_dicts
1280+
mocked_delegated_list_from_dicts = mocker.patch.object(
1281+
async_subtensor.DelegatedInfo,
1282+
"list_from_dicts",
12831283
)
12841284

12851285
# Call

0 commit comments

Comments
 (0)