Created
July 22, 2020 19:56
-
-
Save iamdefinitelyahuman/ea85770a940cc7422ce30c017ac7906b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from brownie import accounts | |
| from brownie.test import given, strategy | |
| @given( | |
| receiver=strategy('address', exclude=accounts[0]), | |
| amount=strategy('uint256', max_value=10**18), | |
| ) | |
| def test_transfer_adjusts_receiver_balance(accounts, token, receiver, amount): | |
| balance = token.balanceOf(receiver) | |
| token.transfer(to, amount, {'from': accounts[0]}) | |
| assert token.balanceOf(receiver) == balance + amount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, if I try to run this I get the error below.
Is it possible that you cannot use
accounts[0]in the context of a strategy? Seems it has no value, and the tests ASSIGNS accounts[0] as a valid value even in this example.Am I missing something? Thanks!