[Zope3-checkins] CVS: Zope3/lib/python/Zope/Schema/tests - testSchema.py:1.5

Martijn Faassen m.faassen@vet.uu.nl
Thu, 12 Dec 2002 05:42:34 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Schema/tests
In directory cvs.zope.org:/tmp/cvs-serv15480/tests

Modified Files:
	testSchema.py 
Log Message:
Added getFieldsInOrder, a way to get a list of (name, field) tuples
for a schema in its schema-defined order. 


=== Zope3/lib/python/Zope/Schema/tests/testSchema.py 1.4 => 1.5 ===
--- Zope3/lib/python/Zope/Schema/tests/testSchema.py:1.4	Wed Sep 18 11:05:51 2002
+++ Zope3/lib/python/Zope/Schema/tests/testSchema.py	Thu Dec 12 05:42:33 2002
@@ -19,7 +19,8 @@
      ValidationErrorsAll
 from Interface import Interface
 from Zope.Schema import Bytes, ErrorNames
-from Zope.Schema import validateMapping, validateMappingAll, getFields
+from Zope.Schema import validateMapping, validateMappingAll,\
+     getFields, getFieldsInOrder
 
 class ISchemaTest(Interface):
     title = Bytes(
@@ -89,7 +90,13 @@
         for key, value in fields.iteritems():
             self.assertEquals(key, value.getName())
         
-
+    def test_getFieldsInOrder(self):
+        fields = getFieldsInOrder(ISchemaTest)
+        field_names = [name for name, field in fields]
+        self.assertEquals(field_names, ['title', 'description', 'spam'])
+        for key, value in fields:
+            self.assertEquals(key, value.getName())
+            
 def test_suite():
     return makeSuite(SchemaTest)