コード例 #1
0
def test_get_ethpm_birth_block(w3, interval):
    time_travel(w3, interval)
    latest_block = w3.eth.getBlock("latest")
    time_travel(w3, interval)
    actual = get_ethpm_birth_block(w3, 0, w3.eth.blockNumber,
                                   latest_block.timestamp)
    assert actual == latest_block.number - 1
コード例 #2
0
def test_get_ethpm_birth_block_invalid_range_raises_exception(w3):
    latest_block = w3.eth.getBlock("latest")
    with pytest.raises(BlockNotFoundError):
        time_travel(w3, 1)
        get_ethpm_birth_block(w3, w3.eth.blockNumber, 0,
                              latest_block.timestamp)
コード例 #3
0
def test_get_ethpm_birth_block_equal_blocks_raises_exception(w3):
    latest_block = w3.eth.getBlock("latest")
    with pytest.raises(BlockNotFoundError):
        get_ethpm_birth_block(w3, 0, w3.eth.blockNumber,
                              latest_block.timestamp)