Skip to content

test_eof_example_parameters()

Documentation for tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py::test_eof_example_parameters@21fb11c8.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py::test_eof_example_parameters --fork Osaka

Example of EOF example parameters.

Source code in tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
@pytest.mark.parametrize(
    "data_section_bytes",
    (b"\x01", b"\xef"),
)
@pytest.mark.parametrize(
    "code_section_code, exception",
    [(Op.PUSH1(10) + Op.STOP, None), (Op.PUSH1(14), EOFException.MISSING_STOP_OPCODE)],
)
def test_eof_example_parameters(
    eof_test: EOFTestFiller,
    data_section_bytes: bytes,
    code_section_code: Bytecode,
    exception: EOFException,
):
    """Example of EOF example parameters."""
    eof_code = Container(
        name="parametrized_eof_example",
        sections=[
            Section.Code(
                code=code_section_code,
                max_stack_height=1,
            ),
            Section.Data(data_section_bytes),
        ],
        validity_error=exception,
    )

    eof_test(
        container=eof_code,
        expect_exception=eof_code.validity_error,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) code_section_code exception data_section_bytes
...fork_Osaka-eof_test-code_section_code_-exception_None-data_section_bytes_b'\x01' None 01
...fork_Osaka-eof_test-code_section_code_-exception_None-data_section_bytes_b'\xef' None ef
...fork_Osaka-eof_test-code_section_code_-exception_EOFException.MISSING_STOP_OPCODE-data_section_bytes_b'\x01' EOFException.MISSING_STOP_OPCODE 01
...fork_Osaka-eof_test-code_section_code_-exception_EOFException.MISSING_STOP_OPCODE-data_section_bytes_b'\xef' EOFException.MISSING_STOP_OPCODE ef