コード例 #1
0
def test_input_munger_parameter_passthrough_mismatch_arity():
    method = Method(
        mungers=[lambda m, z, y: 'success'],
        json_rpc_method='eth_method',
    )
    with pytest.raises(TypeError):
        method.input_munger(object(), ['first', 'second', 'third'], {})
コード例 #2
0
def test_default_input_munger_with_input_parameters_exception():
    method = Method(
        mungers=[],
        json_rpc_method='eth_method',
    )
    with pytest.raises(TypeError):
        method.input_munger(object(), [1], {})
コード例 #3
0
def test_default_munger_for_property_with_input_parameters_raises_ValidationError(
):
    method = Method(
        is_property=True,
        json_rpc_method='eth_method',
    )
    with pytest.raises(ValidationError,
                       match='Parameters cannot be passed to a property'):
        method.input_munger(object(), [1], {})
コード例 #4
0
def test_input_munger_parameter_passthrough_matching_arity():
    method = Method(
        mungers=[lambda m, z, y: ['success']],
        json_rpc_method='eth_method',
    )
    assert method.input_munger(object(), ['first', 'second'],
                               {}) == ['success']
コード例 #5
0
def test_empty_mungers_for_property_with_no_input_parameters(empty):
    method = Method(
        is_property=True,
        mungers=empty,
        json_rpc_method='eth_method',
    )
    assert method.input_munger(object(), [], {}) == ()
コード例 #6
0
def test_default_input_munger_with_no_input_parameters():
    method = Method(json_rpc_method='eth_method', )
    assert method.input_munger(object(), [], {}) == []
コード例 #7
0
def test_default_munger_for_property_with_no_input_parameters():
    method = Method(
        is_property=True,
        json_rpc_method='eth_method',
    )
    assert method.input_munger(object(), [], {}) == ()
コード例 #8
0
def test_empty_input_mungers_with_input_parameters(empty):
    method = Method(
        mungers=empty,
        json_rpc_method='eth_method',
    )
    assert method.input_munger(object(), [1], {}) == [1]
コード例 #9
0
def test_input_munger_falsy_config_result_in_default_munger():
    method = Method(mungers=[],
                    json_rpc_method='eth_method',
                    formatter_lookup_fn='')
    method.input_munger((object(), [], {})) == []
コード例 #10
0
def test_input_munger_parameter_passthrough_matching_arity():
    method = Method(mungers=[lambda m, z, y: ['success']],
                    json_rpc_method='eth_method',
                    formatter_lookup_fn='')
    method.input_munger((object(), ['first', 'second'], {})) == 'success'
コード例 #11
0
def test_input_munger_falsy_config_result_in_default_munger():
    method = Method(
        mungers=[],
        json_rpc_method='eth_method',
    )
    method.input_munger(object(), [], {}) == []