diff options
| -rw-r--r-- | docs/verify.rst | 8 | ||||
| -rw-r--r-- | src/zope/interface/verify.py | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/docs/verify.rst b/docs/verify.rst index f400f23..364aedb 100644 --- a/docs/verify.rst +++ b/docs/verify.rst @@ -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:: diff --git a/src/zope/interface/verify.py b/src/zope/interface/verify.py index 77366be..40c0fb1 100644 --- a/src/zope/interface/verify.py +++ b/src/zope/interface/verify.py @@ -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 |
