Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHIA-2282 Improve some coins checks in test_select_coins_rpc #19206

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions chia/_tests/wallet/rpc/test_wallet_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1826,8 +1826,8 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
wallet_id=1,
coin_selection_config=DEFAULT_COIN_SELECTION_CONFIG.override(min_coin_amount=uint64(1001)),
)
assert min_coins is not None
assert len(min_coins) == 1 and min_coins[0].amount == uint64(10000)
assert len(min_coins) == 1
assert min_coins[0].amount == uint64(10_000)

# test max coin amount
max_coins: list[Coin] = await client_2.select_coins(
Expand All @@ -1837,8 +1837,8 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
min_coin_amount=uint64(999), max_coin_amount=uint64(9999)
),
)
assert max_coins is not None
assert len(max_coins) == 2 and max_coins[0].amount == uint64(1000)
assert len(max_coins) == 2
assert max_coins[0].amount == uint64(1000)

# test excluded coin amounts
non_1000_amt: int = sum(a for a in tx_amounts if a != 1000)
Expand All @@ -1847,11 +1847,8 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
wallet_id=1,
coin_selection_config=DEFAULT_COIN_SELECTION_CONFIG.override(excluded_coin_amounts=[uint64(1000)]),
)
assert excluded_amt_coins is not None
assert (
len(excluded_amt_coins) == len(tuple(a for a in tx_amounts if a != 1000))
and sum(c.amount for c in excluded_amt_coins) == non_1000_amt
)
assert len(excluded_amt_coins) == len([a for a in tx_amounts if a != 1000])
assert sum(c.amount for c in excluded_amt_coins) == non_1000_amt

# test excluded coins
with pytest.raises(ValueError):
Expand Down
Loading