Skip to content

Commit 1a17a32

Browse files
committed
Remove Web3ValidationError dependency on eth-utils ValidationError
1 parent 5fe5dc4 commit 1a17a32

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

newsfragments/3443.breaking.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove ``Web3ValidationError`` dependence / inheritance from `eth-utils` ``ValidationError``.

tests/core/method-class/test_method.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
)
44
import pytest
55

6-
from eth_utils import (
7-
ValidationError,
8-
)
96
from eth_utils.toolz import (
107
compose,
118
)
@@ -15,6 +12,7 @@
1512
Web3,
1613
)
1714
from web3.exceptions import (
15+
Web3ValidationError,
1816
Web3ValueError,
1917
)
2018
from web3.method import (
@@ -160,34 +158,36 @@ def test_empty_mungers_for_property_with_no_input_parameters(empty):
160158
assert method.input_munger(object(), [], {}) == ()
161159

162160

163-
def test_default_munger_for_property_with_input_parameters_raises_ValidationError():
161+
def test_default_munger_for_property_with_input_params_raises_validation_error():
164162
method = Method(
165163
is_property=True,
166164
json_rpc_method="eth_method",
167165
)
168166
with pytest.raises(
169-
ValidationError, match="Parameters cannot be passed to a property"
167+
Web3ValidationError, match="Parameters cannot be passed to a property"
170168
):
171169
method.input_munger(object(), [1], {})
172170

173171

174172
@pytest.mark.parametrize(
175173
"empty", ([], (), None), ids=["empty-list", "empty-tuple", "None"]
176174
)
177-
def test_empty_mungers_for_property_with_input_parameters_raises_ValidationError(empty):
175+
def test_empty_mungers_for_property_with_input_params_raises_validation_error(empty):
178176
method = Method(
179177
is_property=True,
180178
mungers=empty,
181179
json_rpc_method="eth_method",
182180
)
183181
with pytest.raises(
184-
ValidationError, match="Parameters cannot be passed to a property"
182+
Web3ValidationError, match="Parameters cannot be passed to a property"
185183
):
186184
method.input_munger(object(), [1], {})
187185

188186

189-
def test_property_with_mungers_raises_ValidationError():
190-
with pytest.raises(ValidationError, match="Mungers cannot be used with a property"):
187+
def test_property_with_mungers_raises_validation_error():
188+
with pytest.raises(
189+
Web3ValidationError, match="Mungers cannot be used with a property"
190+
):
191191
Method(
192192
is_property=True,
193193
mungers=[lambda m, z, y: "success"],

web3/exceptions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88
Union,
99
)
1010

11-
from eth_utils import (
12-
ValidationError,
13-
)
14-
1511
from web3.types import (
1612
BlockData,
1713
RPCResponse,
@@ -184,8 +180,7 @@ class FallbackNotFound(Web3Exception):
184180
"""
185181

186182

187-
# type ignored because subclassing ValidationError which has type Any
188-
class Web3ValidationError(Web3Exception, ValidationError): # type: ignore[misc]
183+
class Web3ValidationError(Web3Exception):
189184
"""
190185
Raised when a supplied value is invalid.
191186
"""

0 commit comments

Comments
 (0)