Skip to content

Commit 9f9bd39

Browse files
committed
Merge remote-tracking branch 'origin/feat/zyzniewski/set_delegate_take' into feat/zyzniewski/set_delegate_take
2 parents 572d1fa + 1597a3f commit 9f9bd39

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

tests/e2e_tests/test_staking.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import pytest
2-
1+
from bittensor import logging
32
from bittensor.core.chain_data.stake_info import StakeInfo
43
from bittensor.utils.balance import Balance
54
from tests.e2e_tests.utils.chain_interactions import ANY_BALANCE
6-
from bittensor import logging
5+
from tests.helpers.helpers import ApproxBalance
76

87
logging.enable_info()
98

@@ -134,9 +133,6 @@ def test_single_operation(subtensor, alice_wallet, bob_wallet):
134133
assert stake == Balance(0)
135134

136135

137-
@pytest.mark.skip(
138-
reason="add_stake_multiple and unstake_multiple doesn't return (just hangs)",
139-
)
140136
def test_batch_operations(subtensor, alice_wallet, bob_wallet):
141137
"""
142138
Tests:
@@ -216,7 +212,7 @@ def test_batch_operations(subtensor, alice_wallet, bob_wallet):
216212
)
217213

218214
assert balances == {
219-
alice_wallet.coldkey.ss58_address: alice_balance,
215+
alice_wallet.coldkey.ss58_address: ApproxBalance(alice_balance.rao),
220216
bob_wallet.coldkey.ss58_address: Balance.from_tao(999_998),
221217
}
222218

tests/helpers/helpers.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ def __eq__(self, __o: Union[float, int, Balance]) -> bool:
4444
) or ((__o - self.tolerance) <= self.value <= (__o + self.tolerance))
4545

4646

47+
class ApproxBalance(CLOSE_IN_VALUE, Balance):
48+
def __init__(
49+
self,
50+
balance: Union[float, int],
51+
tolerance: Union[float, int] = 0.1,
52+
):
53+
super().__init__(
54+
Balance(balance),
55+
Balance(tolerance),
56+
)
57+
58+
@property
59+
def rao(self):
60+
return self.value.rao
61+
62+
4763
def assert_submit_signed_extrinsic(
4864
substrate,
4965
keypair,

0 commit comments

Comments
 (0)