Fix the documentation so it can be tested with `ZOPE_INTERFACE_STRICT_IRO=1`. (#242)
Closes #241.
This commit is contained in:
parent
7928bb3374
commit
077ff5b322
|
@ -283,7 +283,7 @@ jobs:
|
|||
pip install -U "`ls dist/zope.interface-*.whl`[docs]"
|
||||
- name: Build docs
|
||||
env:
|
||||
ZOPE_INTERFACE_STRICT_IRO: 0
|
||||
ZOPE_INTERFACE_STRICT_IRO: 1
|
||||
run: |
|
||||
sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
|
||||
sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
|
||||
|
|
|
@ -744,7 +744,7 @@ Exmples for :meth:`Declaration.__sub__`:
|
|||
>>> spec -= I1
|
||||
>>> [iface.getName() for iface in spec]
|
||||
[]
|
||||
>>> spec -= Declaration(I1, I2)
|
||||
>>> spec -= Declaration(I2)
|
||||
>>> [iface.getName() for iface in spec]
|
||||
[]
|
||||
>>> spec = Declaration(I2, I4)
|
||||
|
@ -755,7 +755,7 @@ Exmples for :meth:`Declaration.__sub__`:
|
|||
>>> [iface.getName() for iface in spec - I1]
|
||||
['I4']
|
||||
>>> [iface.getName() for iface
|
||||
... in spec - Declaration(I3, I4)]
|
||||
... in spec - Declaration(I4)]
|
||||
['I2']
|
||||
|
||||
Exmples for :meth:`Declaration.__add__`:
|
||||
|
@ -784,7 +784,7 @@ Exmples for :meth:`Declaration.__add__`:
|
|||
['IRoot1']
|
||||
>>> [iface.getName() for iface in spec2]
|
||||
[]
|
||||
>>> spec2 += Declaration(IRoot2, IDerived2)
|
||||
>>> spec2 += Declaration(IDerived2, IRoot2)
|
||||
>>> [iface.getName() for iface in spec2]
|
||||
['IDerived2', 'IRoot2']
|
||||
>>> [iface.getName() for iface in spec+spec2]
|
||||
|
|
|
@ -83,11 +83,17 @@ desired interface.
|
|||
True
|
||||
|
||||
If all instances will provide the interface, we can
|
||||
mark the 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::
|
||||
|
||||
>>> from zope.interface import classImplements
|
||||
>>> from zope.interface import noLongerProvides
|
||||
>>> import gc
|
||||
>>> noLongerProvides(foo, IFoo)
|
||||
>>> _ = gc.collect()
|
||||
>>> classImplements(Foo, IFoo)
|
||||
>>> verify_foo()
|
||||
True
|
||||
|
|
Loading…
Reference in New Issue