Skip to content

Commit b0ad9e2

Browse files
committed
fix(tests): tox
1 parent eb61e9f commit b0ad9e2

File tree

3 files changed

+32
-33
lines changed

3 files changed

+32
-33
lines changed

tests/cancun/eip4788_beacon_root/conftest.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,20 @@
66
import pytest
77

88
from ethereum_test_forks import Fork
9-
from ethereum_test_tools import AccessList, Account, Address, Alloc, Bytecode, Environment, Hash
9+
from ethereum_test_tools import (
10+
AccessList,
11+
Account,
12+
Address,
13+
Alloc,
14+
Bytecode,
15+
Environment,
16+
Hash,
17+
Storage,
18+
Transaction,
19+
add_kzg_version,
20+
keccak256,
21+
)
1022
from ethereum_test_tools import Opcodes as Op
11-
from ethereum_test_tools import Storage, Transaction, add_kzg_version, keccak256
1223

1324
from .spec import Spec, SpecHelpers
1425

tests/cancun/eip4844_blobs/conftest.py

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,32 @@
1010

1111
@pytest.fixture
1212
def block_base_fee_per_gas() -> int:
13-
"""Default max fee per gas for transactions sent during test."""
13+
"""Return default max fee per gas for transactions sent during test."""
1414
return 7
1515

1616

1717
@pytest.fixture
1818
def target_blobs_per_block(fork: Fork) -> int:
19-
"""
20-
Default number of blobs to be included in the block.
21-
"""
19+
"""Return default number of blobs to be included in the block."""
2220
return fork.target_blobs_per_block()
2321

2422

2523
@pytest.fixture
2624
def max_blobs_per_block(fork: Fork) -> int:
27-
"""
28-
Default number of blobs to be included in the block.
29-
"""
25+
"""Return default number of blobs to be included in the block."""
3026
return fork.max_blobs_per_block()
3127

3228

3329
@pytest.fixture
3430
def blob_gas_per_blob(fork: Fork) -> int:
35-
"""Default blob gas cost per blob."""
31+
"""Return default blob gas cost per blob."""
3632
return fork.blob_gas_per_blob()
3733

3834

3935
@pytest.fixture(autouse=True)
4036
def parent_excess_blobs() -> int | None:
4137
"""
42-
Default excess blobs of the parent block.
38+
Return default excess blobs of the parent block.
4339
4440
Can be overloaded by a test case to provide a custom parent excess blob
4541
count.
@@ -50,7 +46,7 @@ def parent_excess_blobs() -> int | None:
5046
@pytest.fixture(autouse=True)
5147
def parent_blobs() -> int | None:
5248
"""
53-
Default data blobs of the parent blob.
49+
Return default data blobs of the parent blob.
5450
5551
Can be overloaded by a test case to provide a custom parent blob count.
5652
"""
@@ -62,9 +58,7 @@ def parent_excess_blob_gas(
6258
parent_excess_blobs: int | None,
6359
blob_gas_per_blob: int,
6460
) -> int | None:
65-
"""
66-
Calculates the excess blob gas of the parent block from the excess blobs.
67-
"""
61+
"""Calculate the excess blob gas of the parent block from the excess blobs."""
6862
if parent_excess_blobs is None:
6963
return None
7064
assert parent_excess_blobs >= 0
@@ -78,7 +72,7 @@ def excess_blob_gas(
7872
parent_blobs: int | None,
7973
) -> int | None:
8074
"""
81-
Calculates the excess blob gas of the block under test from the parent block.
75+
Calculate the excess blob gas of the block under test from the parent block.
8276
8377
Value can be overloaded by a test case to provide a custom excess blob gas.
8478
"""
@@ -98,7 +92,7 @@ def correct_excess_blob_gas(
9892
parent_blobs: int | None,
9993
) -> int:
10094
"""
101-
Calculates the correct excess blob gas of the block under test from the parent block.
95+
Calculate the correct excess blob gas of the block under test from the parent block.
10296
10397
Should not be overloaded by a test case.
10498
"""
@@ -125,9 +119,7 @@ def blob_gas_price(
125119
fork: Fork,
126120
excess_blob_gas: int | None,
127121
) -> int | None:
128-
"""
129-
Blob gas price for the block of the test.
130-
"""
122+
"""Return blob gas price for the block of the test."""
131123
if excess_blob_gas is None:
132124
return None
133125

@@ -144,9 +136,7 @@ def genesis_excess_blob_gas(
144136
target_blobs_per_block: int,
145137
blob_gas_per_blob: int,
146138
) -> int:
147-
"""
148-
Default excess blob gas for the genesis block.
149-
"""
139+
"""Return default excess blob gas for the genesis block."""
150140
excess_blob_gas = parent_excess_blob_gas if parent_excess_blob_gas else 0
151141
if parent_blobs:
152142
# We increase the excess blob gas of the genesis because
@@ -161,9 +151,7 @@ def env(
161151
block_base_fee_per_gas: int,
162152
genesis_excess_blob_gas: int,
163153
) -> Environment:
164-
"""
165-
Prepare the environment of the genesis block for all blockchain tests.
166-
"""
154+
"""Prepare the environment of the genesis block for all blockchain tests."""
167155
return Environment(
168156
excess_blob_gas=genesis_excess_blob_gas,
169157
blob_gas_used=0,
@@ -174,7 +162,7 @@ def env(
174162
@pytest.fixture
175163
def tx_value() -> int:
176164
"""
177-
Default value contained by the transactions sent during test.
165+
Return default value contained by the transactions sent during test.
178166
179167
Can be overloaded by a test case to provide a custom transaction value.
180168
"""
@@ -183,7 +171,7 @@ def tx_value() -> int:
183171

184172
@pytest.fixture
185173
def tx_calldata() -> bytes:
186-
"""Default calldata in transactions sent during test."""
174+
"""Return default calldata in transactions sent during test."""
187175
return b""
188176

189177

@@ -205,7 +193,7 @@ def tx_max_fee_per_gas(
205193
@pytest.fixture
206194
def tx_max_priority_fee_per_gas() -> int:
207195
"""
208-
Default max priority fee per gas for transactions sent during test.
196+
Return default max priority fee per gas for transactions sent during test.
209197
210198
Can be overloaded by a test case to provide a custom max priority fee per
211199
gas.
@@ -216,7 +204,7 @@ def tx_max_priority_fee_per_gas() -> int:
216204
@pytest.fixture
217205
def tx_max_fee_per_blob_gas_multiplier() -> int:
218206
"""
219-
Default max fee per blob gas multiplier for transactions sent during test.
207+
Return default max fee per blob gas multiplier for transactions sent during test.
220208
221209
Can be overloaded by a test case to provide a custom max fee per blob gas
222210
multiplier.
@@ -227,7 +215,7 @@ def tx_max_fee_per_blob_gas_multiplier() -> int:
227215
@pytest.fixture
228216
def tx_max_fee_per_blob_gas_delta() -> int:
229217
"""
230-
Default max fee per blob gas delta for transactions sent during test.
218+
Return default max fee per blob gas delta for transactions sent during test.
231219
232220
Can be overloaded by a test case to provide a custom max fee per blob gas
233221
delta.
@@ -242,7 +230,7 @@ def tx_max_fee_per_blob_gas( # noqa: D103
242230
tx_max_fee_per_blob_gas_delta: int,
243231
) -> int:
244232
"""
245-
Default max fee per blob gas for transactions sent during test.
233+
Return default max fee per blob gas for transactions sent during test.
246234
247235
By default, it is set to the blob gas price of the block.
248236

tests/cancun/eip4844_blobs/test_blobhash_opcode_contexts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def create_opcode_context(pre, tx, post):
4343
def simple_blob_hashes(
4444
max_blobs_per_block: int,
4545
) -> List[bytes]:
46-
"""Simple list of blob versioned hashes ranging from bytes32(1 to 4)"""
46+
"""Return a simple list of blob versioned hashes ranging from bytes32(1 to 4)."""
4747
return add_kzg_version(
4848
[(1 << x) for x in range(max_blobs_per_block)],
4949
Spec.BLOB_COMMITMENT_VERSION_KZG,

0 commit comments

Comments
 (0)