Ejemplo n.º 1
0
def test_parse_tuple_type_str_normalizes_and_parses_types():
    tuple_coder = TupleCoder.from_type_str('(int,int)', None)

    assert tuple_coder.components == (
        BasicType('int', 256, None),
        BasicType('int', 256, None),
    )
Ejemplo n.º 2
0
from eth_abi.grammar import (
    TYPE_ALIASES,
    BasicType,
    TupleType,
    normalize,
    parse,
)

from .common.strategies import (
    malformed_type_strs,
    type_strs,
)


@pytest.mark.parametrize('type_str, expected_type', (
    ('custom', BasicType('custom')),
    ('Custom', BasicType('Custom')),
    ('CUSTOM', BasicType('CUSTOM')),
    ('Custom[2]', BasicType('Custom', None, ((2, ), ))),
    ('uint', BasicType('uint')),
    ('uint256', BasicType('uint', 256)),
    ('uint256[]', BasicType('uint', 256, ((), ))),
    ('uint256[][1][23][]', BasicType('uint', 256, ((), (1, ), (23, ), ()))),
    ('uint[]', BasicType('uint', None, ((), ))),
    ('int[2]', BasicType('int', None, ((2, ), ))),
    ('fixed128x19', BasicType('fixed', (128, 19))),
    ('ufixed128x19[][]', BasicType('ufixed', (128, 19), ((), ()))),
    (
        '(int,ufixed128x19[][])',
        TupleType((
            BasicType('int'),