diff options
author | Michael Howitz <mh@gocept.com> | 2021-04-23 14:47:23 +0200 |
---|---|---|
committer | Michael Howitz <mh@gocept.com> | 2021-04-23 14:47:23 +0200 |
commit | c188b49f5b0b8f23d085fce0b098d370958f8d30 (patch) | |
tree | ae42b4ce182bd8de8f43d072632313e1545c5e96 | |
parent | 08cc6f822806c0be7fdf422219b658661b7bcf75 (diff) | |
download | zope-interface-issue-241/docs-strict-iro.tar.gz |
Implement suggestions from code review.issue-241/docs-strict-iro
-rw-r--r-- | docs/api/declarations.rst | 12 | ||||
-rw-r--r-- | docs/verify.rst | 15 |
2 files changed, 15 insertions, 12 deletions
diff --git a/docs/api/declarations.rst b/docs/api/declarations.rst index 673b504..57c11f0 100644 --- a/docs/api/declarations.rst +++ b/docs/api/declarations.rst @@ -784,17 +784,17 @@ Exmples for :meth:`Declaration.__add__`: ['IRoot1'] >>> [iface.getName() for iface in spec2] [] - >>> spec2 += Declaration(IDerived2) + >>> spec2 += Declaration(IDerived2, IRoot2) >>> [iface.getName() for iface in spec2] - ['IDerived2'] + ['IDerived2', 'IRoot2'] >>> [iface.getName() for iface in spec+spec2] - ['IRoot1', 'IDerived2'] + ['IRoot1', 'IDerived2', 'IRoot2'] >>> [iface.getName() for iface in spec2+spec] - ['IDerived2', 'IRoot1'] + ['IDerived2', 'IRoot2', 'IRoot1'] >>> [iface.getName() for iface in (spec+spec2).__bases__] - ['IRoot1', 'IDerived2'] + ['IRoot1', 'IDerived2', 'IRoot2'] >>> [iface.getName() for iface in (spec2+spec).__bases__] - ['IDerived2', 'IRoot1'] + ['IDerived2', 'IRoot2', 'IRoot1'] diff --git a/docs/verify.rst b/docs/verify.rst index c9ac694..bc1be1c 100644 --- a/docs/verify.rst +++ b/docs/verify.rst @@ -83,16 +83,19 @@ desired interface. True If all instances will provide the interface, we can -mark a class as implementing it. +mark a class as implementing it. But we have to remove the interface from the +instance first so a consistent interface resolution order can be achieved. +(Calling ``gc.collect()`` is also necessary because we use weakrefs.) .. doctest:: - >>> class Foo2(object): - ... x = 1 - ... y = 2 >>> from zope.interface import classImplements - >>> classImplements(Foo2, IFoo) - >>> verifyObject(IFoo, Foo2()) + >>> from zope.interface import noLongerProvides + >>> import gc + >>> noLongerProvides(foo, IFoo) + >>> _ = gc.collect() + >>> classImplements(Foo, IFoo) + >>> verify_foo() True |