Also document the not-a-method case.
This commit is contained in:
parent
a825e5f29e
commit
e8a4da9d5e
|
@ -151,6 +151,14 @@ different type of exception, so we need an updated helper.
|
|||
... except BrokenMethodImplementation as e:
|
||||
... print(e)
|
||||
|
||||
Not being callable is an error.
|
||||
|
||||
.. doctest::
|
||||
|
||||
>>> Foo.simple = 42
|
||||
>>> verify_foo()
|
||||
The object <Foo...> violates its contract in IFoo.simple(arg1): implementation is not a method.
|
||||
|
||||
Taking too few arguments is an error.
|
||||
|
||||
.. doctest::
|
||||
|
|
|
@ -110,7 +110,7 @@ def _verify(iface, candidate, tentative=False, vtype=None):
|
|||
continue
|
||||
else:
|
||||
if not callable(attr):
|
||||
raise BrokenMethodImplementation(name, "Not a method", candidate)
|
||||
raise BrokenMethodImplementation(desc, "implementation is not a method", candidate)
|
||||
# sigh, it's callable, but we don't know how to introspect it, so
|
||||
# we have to give it a pass.
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue