def METHOD_NAME(accounts, config, gas_limit, gas_buffer):
    """gas limit is set correctly using web3.eth.estimate_gas"""
    config.active_network["settings"]["gas_limit"] = gas_limit
    config.active_network["settings"]["gas_buffer"] = gas_buffer
    foo = compile_source(code).Foo.deploy({"from": accounts[0]})
    tx = accounts[0].transfer(foo, 1000)
    assert int(tx.gas_used * gas_buffer) == tx.gas_limit