Skip to content

Commit

Permalink
fix: async get_delegated
Browse files Browse the repository at this point in the history
  • Loading branch information
zyzniewski-reef committed Feb 26, 2025
1 parent 5804210 commit 7b7c1cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion bittensor/core/async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
decode_account_id,
DynamicInfo,
)
from bittensor.core.chain_data.delegate_info import DelegatedInfo
from bittensor.core.chain_data.utils import decode_metadata
from bittensor.core.config import Config
from bittensor.core.errors import SubstrateRequestException
Expand Down Expand Up @@ -1219,7 +1220,7 @@ async def get_delegated(
if not result:
return []

return DelegateInfo.delegated_list_from_dicts(result)
return DelegatedInfo.list_from_dicts(result)

async def get_delegates(
self,
Expand Down
18 changes: 9 additions & 9 deletions tests/unit_tests/test_async_subtensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1217,9 +1217,9 @@ async def test_get_delegated_no_block_hash_no_reuse(subtensor, mocker):
# Preps
fake_coldkey_ss58 = "fake_ss58_address"

mocked_delegated_list_from_dicts = mocker.Mock()
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
mocked_delegated_list_from_dicts
mocked_delegated_list_from_dicts = mocker.patch.object(
async_subtensor.DelegatedInfo,
"list_from_dicts",
)

# Call
Expand All @@ -1245,9 +1245,9 @@ async def test_get_delegated_with_block_hash(subtensor, mocker):
fake_coldkey_ss58 = "fake_ss58_address"
fake_block_hash = "fake_block_hash"

mocked_delegated_list_from_dicts = mocker.Mock()
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
mocked_delegated_list_from_dicts
mocked_delegated_list_from_dicts = mocker.patch.object(
async_subtensor.DelegatedInfo,
"list_from_dicts",
)

# Call
Expand Down Expand Up @@ -1275,9 +1275,9 @@ async def test_get_delegated_with_reuse_block(subtensor, mocker):
fake_coldkey_ss58 = "fake_ss58_address"
reuse_block = True

mocked_delegated_list_from_dicts = mocker.Mock()
async_subtensor.DelegateInfo.delegated_list_from_dicts = (
mocked_delegated_list_from_dicts
mocked_delegated_list_from_dicts = mocker.patch.object(
async_subtensor.DelegatedInfo,
"list_from_dicts",
)

# Call
Expand Down

0 comments on commit 7b7c1cf

Please sign in to comment.