Skip to content

Commit 38f2156

Browse files
add get_dynamic_balance for tests purposes
1 parent 14c2f47 commit 38f2156

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

tests/e2e_tests/utils/chain_interactions.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"""
55

66
import asyncio
7-
import unittest.mock
87
from typing import Union, Optional, TYPE_CHECKING
98

9+
from bittensor.utils.balance import Balance
1010
from bittensor.utils.btlogging import logging
1111

1212
# for typing purposes
@@ -16,10 +16,9 @@
1616
from async_substrate_interface import SubstrateInterface, ExtrinsicReceipt
1717

1818

19-
ANY_BALANCE = unittest.mock.Mock(
20-
rao=unittest.mock.ANY,
21-
unit=unittest.mock.ANY,
22-
)
19+
def get_dynamic_balance(rao: int, netuid: int = 0):
20+
"""Returns a Balance object with the given rao and netuid for testing purposes with synamic values."""
21+
return Balance(rao).set_unit(netuid)
2322

2423

2524
def sudo_set_hyperparameter_bool(
@@ -198,7 +197,7 @@ async def root_set_subtensor_hyperparameter_values(
198197
call_function: str,
199198
call_params: dict,
200199
return_error_message: bool = False,
201-
) -> tuple[bool, str]:
200+
) -> tuple[bool, Optional[dict]]:
202201
"""
203202
Sets liquid alpha values using AdminUtils. Mimics setting hyperparams
204203
"""
@@ -218,7 +217,7 @@ async def root_set_subtensor_hyperparameter_values(
218217
if return_error_message:
219218
return response.is_success, response.error_message
220219

221-
return response.is_success, ""
220+
return response.is_success, None
222221

223222

224223
def set_identity(

0 commit comments

Comments
 (0)