Skip to content

Commit e803c98

Browse files
fix: pydantic model validation for benchmark manager
1 parent 943121c commit e803c98

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/ethereum_test_specs/benchmark.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,17 @@ def __get_pydantic_core_schema__(
150150
cls, source_type: Any, handler: GetCoreSchemaHandler
151151
) -> PlainValidatorFunctionSchema:
152152
"""Provide Pydantic core schema for BenchmarkManager serialization and validation."""
153+
154+
def validate_benchmark_manager(value):
155+
if isinstance(value, cls):
156+
return value
157+
if value is None:
158+
return None
159+
# If value is passed as arguments, create new instance with no args
160+
return cls()
161+
153162
return no_info_plain_validator_function(
154-
cls,
163+
validate_benchmark_manager,
155164
serialization=to_string_ser_schema(),
156165
)
157166

tests/benchmark/test_worst_stateful_opcodes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ def test_worst_blockhash(
487487
pre=pre,
488488
post={},
489489
benchmark_manager=benchmark_manager,
490-
gas_benchmark_value=gas_benchmark_value,
491490
)
492491

493492

0 commit comments

Comments
 (0)