Skip to content

Commit

Permalink
Add comment explaining negative block id test
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjw committed Aug 27, 2018
1 parent 6a64fa8 commit 63ebf56
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/core/contracts/test_contract_util_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
)


# This tests negative block number identifiers, which behave like python
# list slices, with -1 being the latest block and -2 being the block before that.
# This test is necessary because transaction calls allow negative block indexes, although
# getBlock() does not allow negative block identifiers. Support for negative block identifier
# will likely be removed in v5.
def test_parse_block_identifier_int(web3):
last_num = web3.eth.getBlock('latest').number
assert 0 == parse_block_identifier_int(web3, -1 - last_num)

0 comments on commit 63ebf56

Please sign in to comment.