We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 122ba1a commit b58a3e2Copy full SHA for b58a3e2
tests/core/method-class/test_method.py
@@ -270,7 +270,7 @@ def dummy_w3():
270
271
272
def test_munger_class_method_access_raises_friendly_error():
273
- with pytest.raises(Exception):
+ with pytest.raises(TypeError):
274
FakeModule.method(1, 2)
275
276
web3/method.py
@@ -83,6 +83,11 @@ def __init__(
83
self.formatter_lookup_fn = formatter_lookup_fn or get_default_formatters
84
85
def __get__(self, obj=None, obj_type=None):
86
+ if obj is None:
87
+ raise TypeError(
88
+ "Direct calls to methods are not supported. "
89
+ "Methods must be called from an module instance, "
90
+ "usually attached to a web3 instance.")
91
return obj.retrieve_caller_fn(self)
92
93
@property
0 commit comments