コード例 #1
0
ファイル: test_tools.py プロジェクト: peizihui/eth-abi
def test_get_abi_strategy_returns_no_strategy_for_invalid_type_strs(
        malformed_type_str):
    try:
        get_abi_strategy(malformed_type_str)
    except (ParseError, NoEntriesFound):
        pass
    else:
        assert False, 'Expected ParseError or NoEntriesFound'
コード例 #2
0
def _build_fn_strategies(contract_abi):
    state_modifying_functions = \
            [fn_abi for fn_abi in contract_abi if not fn_abi['constant']]

    for fn_abi in state_modifying_functions:
        args_sts = [get_abi_strategy(arg['type']) for arg in fn_abi['inputs']]
        yield (fn_abi['name'], args_sts)
コード例 #3
0
def _build_deployment_strategy(contract_abi):
    # Obtain the constructor from the ABI, if one exists
    fn_abi = [fn for fn in contract_abi if fn['type'] == 'constructor']
    assert len(fn_abi) < 2, "This should never happen, but check anyways"
    if len(fn_abi) == 0:
        return None  # Return no strategy (empty set)
    # Return the constructor's ABI deployment strategy list
    return tuple(
        [get_abi_strategy(arg['type']) for arg in fn_abi[0]['inputs']])
コード例 #4
0
ファイル: test_tools.py プロジェクト: peizihui/eth-abi
def test_get_abi_strategy_returns_certain_strategies_for_known_type_strings(
        type_str, strategy_repr):  # noqa: E501
    assert repr(get_abi_strategy(type_str)) == strategy_repr
コード例 #5
0
ファイル: test_tools.py プロジェクト: peizihui/eth-abi
def test_get_abi_strategy_returns_strategy_for_valid_type_strs(type_str):
    assert isinstance(get_abi_strategy(type_str), st.SearchStrategy)