Skip to content

test_single_code_section()

Documentation for tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py::test_single_code_section@83970623.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py::test_single_code_section --fork Osaka

Verify EOF container single code section.

Source code in tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_container_validation.py
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
@pytest.mark.parametrize("plus_data", [False, True])
@pytest.mark.parametrize("plus_container", [False, True])
def test_single_code_section(
    eof_test: EOFTestFiller,
    plus_data: bool,
    plus_container: bool,
):
    """Verify EOF container single code section."""
    sections = [Section.Code(Op.RETURNCONTRACT[0](0, 0) if plus_container else Op.STOP)]
    if plus_container:
        sections.append(
            Section.Container(
                container=Container(
                    sections=[
                        Section.Code(Op.JUMPF[i + 1] if i < (MAX_CODE_SECTIONS - 1) else Op.STOP)
                        for i in range(MAX_CODE_SECTIONS)
                    ],
                )
            )
        )
    if plus_data:
        sections.append(Section.Data(data=b"\0"))
    eof_test(
        container=Container(
            name="single_code_section",
            sections=sections,
            kind=ContainerKind.INITCODE if plus_container else ContainerKind.RUNTIME,
        ),
    )

Parametrized Test Cases

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

Test ID (Abbreviated) plus_container plus_data
...fork_Osaka-eof_test-plus_container_False-plus_data_False False False
...fork_Osaka-eof_test-plus_container_False-plus_data_True False True
...fork_Osaka-eof_test-plus_container_True-plus_data_False True False
...fork_Osaka-eof_test-plus_container_True-plus_data_True True True