[Zope3-checkins] SVN: Zope3/trunk/src/zope/schema/tests/test_ Added
missing collection binding tests.
Jim Fulton
jim at zope.com
Sun Jul 16 11:18:06 EDT 2006
Log message for revision 69146:
Added missing collection binding tests.
Changed:
U Zope3/trunk/src/zope/schema/tests/test_field.py
U Zope3/trunk/src/zope/schema/tests/test_listfield.py
U Zope3/trunk/src/zope/schema/tests/test_setfield.py
U Zope3/trunk/src/zope/schema/tests/test_tuplefield.py
-=-
Modified: Zope3/trunk/src/zope/schema/tests/test_field.py
===================================================================
--- Zope3/trunk/src/zope/schema/tests/test_field.py 2006-07-16 15:10:18 UTC (rev 69145)
+++ Zope3/trunk/src/zope/schema/tests/test_field.py 2006-07-16 15:18:06 UTC (rev 69146)
@@ -61,7 +61,24 @@
self.assertRaises(RequiredMissing, field.validate, None)
+class CollectionFieldTestBase(FieldTestBase):
+ def test_bind_binds_value_type(self):
+ field = self._Field_Factory(
+ __name__ = 'x',
+ title=u'Not required field', description=u'',
+ readonly=False, required=False,
+ value_type=Int(),
+ )
+
+ class C(object):
+ x=None
+
+ c = C()
+ field2 = field.bind(c)
+
+ self.assertEqual(field2.value_type.context, c)
+
class FieldTest(FieldTestBase):
"""Test generic Field."""
Modified: Zope3/trunk/src/zope/schema/tests/test_listfield.py
===================================================================
--- Zope3/trunk/src/zope/schema/tests/test_listfield.py 2006-07-16 15:10:18 UTC (rev 69145)
+++ Zope3/trunk/src/zope/schema/tests/test_listfield.py 2006-07-16 15:18:06 UTC (rev 69146)
@@ -24,9 +24,9 @@
from zope.schema.interfaces import NotAContainer, RequiredMissing
from zope.schema.interfaces import WrongContainedType, WrongType, NotUnique
from zope.schema.interfaces import TooShort, TooLong
-from zope.schema.tests.test_field import FieldTestBase
+from zope.schema.tests.test_field import CollectionFieldTestBase
-class ListTest(FieldTestBase):
+class ListTest(CollectionFieldTestBase):
"""Test the List Field."""
_Field_Factory = List
Modified: Zope3/trunk/src/zope/schema/tests/test_setfield.py
===================================================================
--- Zope3/trunk/src/zope/schema/tests/test_setfield.py 2006-07-16 15:10:18 UTC (rev 69145)
+++ Zope3/trunk/src/zope/schema/tests/test_setfield.py 2006-07-16 15:18:06 UTC (rev 69146)
@@ -26,9 +26,9 @@
from zope.schema.interfaces import NotAContainer, RequiredMissing
from zope.schema.interfaces import WrongContainedType, WrongType, NotUnique
from zope.schema.interfaces import TooShort, TooLong
-from zope.schema.tests.test_field import FieldTestBase
+from zope.schema.tests.test_field import CollectionFieldTestBase
-class SetTest(FieldTestBase):
+class SetTest(CollectionFieldTestBase):
"""Test the Tuple Field."""
_Field_Factory = Set
@@ -166,7 +166,7 @@
self.failUnless(IAbstractSet.providedBy(field))
self.failUnless(ICollection.providedBy(field))
-class FrozenSetTest(FieldTestBase):
+class FrozenSetTest(CollectionFieldTestBase):
"""Test the Tuple Field."""
_Field_Factory = FrozenSet
Modified: Zope3/trunk/src/zope/schema/tests/test_tuplefield.py
===================================================================
--- Zope3/trunk/src/zope/schema/tests/test_tuplefield.py 2006-07-16 15:10:18 UTC (rev 69145)
+++ Zope3/trunk/src/zope/schema/tests/test_tuplefield.py 2006-07-16 15:18:06 UTC (rev 69146)
@@ -24,9 +24,9 @@
from zope.schema.interfaces import NotAContainer, RequiredMissing
from zope.schema.interfaces import WrongContainedType, WrongType, NotUnique
from zope.schema.interfaces import TooShort, TooLong
-from zope.schema.tests.test_field import FieldTestBase
+from zope.schema.tests.test_field import CollectionFieldTestBase
-class TupleTest(FieldTestBase):
+class TupleTest(CollectionFieldTestBase):
"""Test the Tuple Field."""
_Field_Factory = Tuple
More information about the Zope3-Checkins
mailing list