On Thu, 2012-03-22 at 12:19 +0100, Jan-Carel Brand wrote:

<big snip>

> Thanks for the review.
> I've committed my changes and ran the tests with Python 2.6 and 2.7. 
> I don't have Python 3.x handy but will compile the latest and test with
> that as well.

Ok, I tested zope.schema in python 3.2.2 and there were some errors in
test_vocabulary.py that I fixed.

They were all related to the KeysView and ValuesView objects (being
returned by keys() and values() on an OrderedDict) not being indexable.

There is however still one more error when testing with Python 3.2.2,
but this is related to the IContextSourceBinder validation changes made
by rogerineichen.

First the error:

> FAIL: test_validate_source
> (zope.schema.tests.test_choice.ContextSourceBinder_ChoiceFieldTests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File
> "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/tests/test_choice.py",
>  line 133, in test_validate_source
>     choice = Choice(source=s)
>   File
> "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/_field.py",
> line 281, in __init__
>     IContextSourceBinder.providedBy(vocabulary))
> AssertionError
The vocabulary is of type SampleContextSourceBinder from test_choice.py,
which does implement IContextSourceBinder.

> class SampleContextSourceBinder(object):
>     implements(IContextSourceBinder)
>     def __call__(self, context):
>         return SampleVocabulary()
Looking at it in pdb:

> (Pdb) p vocabulary
> <zope.schema.tests.test_choice.SampleContextSourceBinder object at
> 0x3236310>
> (Pdb) pp vocabulary.__provides__.__iro__
> (<InterfaceClass zope.interface.Interface>,)
Just to double-check, I looked at this vocabulary in Python 2.7:

> (Pdb) vocabulary.__provides__.__iro__
> (<InterfaceClass zope.schema.interfaces.IContextSourceBinder>,
> <InterfaceClass zope.interface.Interface>)
There it *does* provide IContextSourceBinder.

Any ideas why this vocabulary doesn't provide it in Python 3?


Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to