Skip to content

Commit

Permalink
fix(tests): required import modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
marioevz committed Jul 16, 2024
1 parent d4d86ff commit 26cf408
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 41 deletions.
3 changes: 1 addition & 2 deletions tests/cancun/eip5656_mcopy/test_mcopy_memory_expansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

import pytest

from ethereum_test_tools import Account, Alloc, Bytecode, Environment
from ethereum_test_tools import Account, Address, Alloc, Bytecode, Environment
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools import StateTestFiller, Storage, Transaction, cost_memory_bytes
from ethereum_test_tools.common.base_types import Address

from .common import REFERENCE_SPEC_GIT_PATH, REFERENCE_SPEC_VERSION

Expand Down
2 changes: 1 addition & 1 deletion tests/prague/eip7692_eof_v1/eip3540_eof_v1/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import List

from ethereum_test_tools import EOFException
from ethereum_test_tools.eof.v1 import (
VERSION_MAX_SECTION_KIND,
AutoSection,
Expand All @@ -17,7 +18,6 @@
MAX_CODE_SECTIONS,
MAX_OPERAND_STACK_HEIGHT,
)
from ethereum_test_tools.exceptions import EOFException
from ethereum_test_tools.vm.opcode import Opcodes as Op

INVALID: List[Container] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import pytest

from ethereum_test_tools import EOFTestFiller, Opcode
from ethereum_test_tools import EOFException, EOFTestFiller, Opcode
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools import UndefinedOpcodes
from ethereum_test_tools.eof.v1 import Container, ContainerKind, EOFException, Section
from ethereum_test_tools.eof.v1 import Container, ContainerKind, Section
from ethereum_test_tools.eof.v1.constants import MAX_OPERAND_STACK_HEIGHT

from .. import EOF_FORK_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import EOFException, EOFTestFiller
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools.eof.v1 import Container, EOFException, Section
from ethereum_test_tools.eof.v1 import Container, Section
from ethereum_test_tools.eof.v1.constants import MAX_INITCODE_SIZE

from .. import EOF_FORK_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import EOFException, EOFTestFiller
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools.eof.v1 import Container, ContainerKind, Section
from ethereum_test_tools.eof.v1.constants import MAX_CODE_SECTIONS
from ethereum_test_tools.exceptions import EOFException

from .. import EOF_FORK_NAME

Expand Down
16 changes: 5 additions & 11 deletions tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_eof_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@

import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import Bytecode, EOFException, EOFTestFiller
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools.eof.v1 import (
AutoSection,
BytesConvertible,
Container,
EOFException,
Section,
)
from ethereum_test_tools.eof.v1 import AutoSection, Container, Section

from .. import EOF_FORK_NAME

Expand Down Expand Up @@ -129,16 +123,16 @@ def test_eof_example_custom_fields(eof_test: EOFTestFiller):

@pytest.mark.parametrize(
"data_section_bytes",
("0x01", "0xef"),
(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: BytesConvertible,
code_section_code: BytesConvertible,
data_section_bytes: bytes,
code_section_code: Bytecode,
exception: EOFException,
):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import EOFException, EOFTestFiller
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools.eof.v1 import Bytes, Container, EOFException, Section
from ethereum_test_tools.eof.v1 import Container, Section

from .. import EOF_FORK_NAME

Expand Down Expand Up @@ -59,7 +59,7 @@
),
Section.Data("0xef"),
],
header_terminator=Bytes(b"\xFF"),
header_terminator=b"\xFF",
),
"ef00010100040200010003040001ff00800001305000ef",
EOFException.MISSING_TERMINATOR,
Expand Down
13 changes: 3 additions & 10 deletions tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@

import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import EOFException, EOFTestFiller
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools.eof.v1 import (
AutoSection,
Bytes,
Container,
EOFException,
Section,
SectionKind,
)
from ethereum_test_tools.eof.v1 import AutoSection, Container, Section, SectionKind

from .. import EOF_FORK_NAME

Expand Down Expand Up @@ -175,7 +168,7 @@ def make_section_order(kind) -> List[Section]:
)
section_type = Section(
kind=SectionKind.TYPE,
data=Bytes.fromhex("00800001"),
data=bytes.fromhex("00800001"),
custom_size=4,
skip_header_listing=calculate_skip_flag(SectionKind.TYPE, CasePosition.HEADER),
skip_body_listing=calculate_skip_flag(SectionKind.TYPE, CasePosition.BODY),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import EOFException, EOFTestFiller
from ethereum_test_tools import Opcodes as Op
from ethereum_test_tools.eof.v1 import Container, EOFException, Section, SectionKind
from ethereum_test_tools.eof.v1 import Container, Section, SectionKind

from .. import EOF_FORK_NAME

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

import pytest

from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Transaction
from ethereum_test_tools.common.types import Storage
from ethereum_test_tools import Account, Alloc, Environment, StateTestFiller, Storage, Transaction
from ethereum_test_tools.eof.v1 import Container, Section
from ethereum_test_tools.vm.opcode import Opcodes as Op

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

from ethereum_test_tools import (
Account,
Address,
Alloc,
Bytecode,
Environment,
StateTestFiller,
Storage,
Transaction,
cost_memory_bytes,
)
from ethereum_test_tools.common.base_types import Address
from ethereum_test_tools.common.helpers import cost_memory_bytes
from ethereum_test_tools.eof.v1 import Container, Section
from ethereum_test_tools.vm.opcode import Opcodes as Op

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
"""
import pytest

from ethereum_test_tools import EOFTestFiller
from ethereum_test_tools import EOFException, EOFTestFiller
from ethereum_test_tools.eof.v1 import Container, ContainerKind, Section
from ethereum_test_tools.exceptions import EOFException
from ethereum_test_tools.vm.opcode import Opcodes as Op

from .. import EOF_FORK_NAME
Expand Down

0 comments on commit 26cf408

Please sign in to comment.