[Zope3-checkins] SVN: zope.formlib/trunk/src/zope/formlib/form.txt Fixed tests for Python2.4

Christophe Combelles ccomb at free.fr
Wed Mar 3 16:12:19 EST 2010


Log message for revision 109624:
  Fixed tests for Python2.4
  

Changed:
  U   zope.formlib/trunk/src/zope/formlib/form.txt

-=-
Modified: zope.formlib/trunk/src/zope/formlib/form.txt
===================================================================
--- zope.formlib/trunk/src/zope/formlib/form.txt	2010-03-03 19:02:08 UTC (rev 109623)
+++ zope.formlib/trunk/src/zope/formlib/form.txt	2010-03-03 21:12:18 UTC (rev 109624)
@@ -235,7 +235,7 @@
 
     >>> request.form['form.min_size'] = u'42'
     >>> request.form['form.max_size'] = u'142'
-    >>> pprint(MyForm(None, request)()) # doctest: +NORMALIZE_WHITESPACE
+    >>> values = MyForm(None, request)() # doctest: +NORMALIZE_WHITESPACE
     <input class="textType" id="form.name" name="form.name" size="20"
            type="text" value="bob"  />
     <input class="textType" id="form.min_size" name="form.min_size" size="10"
@@ -244,9 +244,8 @@
            type="text" value="142.0"  />
     <input class="textType" id="form.color" name="form.color" size="20"
            type="text" value=""  />
-    {'max_size': 142.0,
-     'min_size': 42.0,
-     'name': u'bob'}
+    >>> sorted(values.items())
+    [('max_size', 142.0), ('min_size', 42.0), ('name', u'bob')]
 
 It's up to the form to decide what to do with the information.
 
@@ -311,16 +310,15 @@
 
 If we display the form again, we'll get the same result:
 
-    >>> pprint(MyForm(None, request)()) # doctest: +NORMALIZE_WHITESPACE
+    >>> values = MyForm(None, request)() # doctest: +NORMALIZE_WHITESPACE
     <input class="textType" id="form.name" name="form.name" size="20"
            type="text" value="bob"  />
     <input class="textType" id="form.min_size" name="form.min_size" size="10"
            type="text" value="42.0"  />
     <input class="textType" id="form.max_size" name="form.max_size" size="10"
            type="text" value="142.0"  />
-    {'max_size': 142.0,
-     'min_size': 42.0,
-     'name': u'bob'}
+    >>> sorted(values.items())
+    [('max_size', 142.0), ('min_size', 42.0), ('name', u'bob')]
 
 But if we reduce the maximum below the minimum, we'll get an invariant
 error:
@@ -328,7 +326,7 @@
     >>> request.form['form.min_size'] = u'42'
     >>> request.form['form.max_size'] = u'14'
 
-    >>> pprint(MyForm(None, request)()) # doctest: +NORMALIZE_WHITESPACE
+    >>> values = MyForm(None, request)() # doctest: +NORMALIZE_WHITESPACE
     There were invariant errors:
     Maximum is less than Minimum
     <input class="textType" id="form.name" name="form.name" size="20"
@@ -337,15 +335,14 @@
            type="text" value="42.0"  />
     <input class="textType" id="form.max_size" name="form.max_size" size="10"
            type="text" value="14.0"  />
-    {'max_size': 14.0,
-     'min_size': 42.0,
-     'name': u'bob'}
+    >>> sorted(values.items())
+    [('max_size', 14.0), ('min_size', 42.0), ('name', u'bob')]
 
 We can have field errors and invariant errors:
 
     >>> request.form['form.name'] = u''
 
-    >>> pprint(MyForm(None, request)()) # doctest: +NORMALIZE_WHITESPACE
+    >>> values = MyForm(None, request)() # doctest: +NORMALIZE_WHITESPACE
     There were field errors:
     ('name', u'Name', RequiredMissing('name'))
     There were invariant errors:
@@ -357,8 +354,8 @@
            type="text" value="42.0"  />
     <input class="textType" id="form.max_size" name="form.max_size" size="10"
            type="text" value="14.0"  />
-    {'max_size': 14.0,
-     'min_size': 42.0}
+    >>> sorted(values.items())
+    [('max_size', 14.0), ('min_size', 42.0)]
 
 If the inputs for some fields tested by invariants are missing, the
 invariants are ignored:
@@ -538,7 +535,7 @@
     >>> request.form['form.min_size'] = u'42'
     >>> request.form['form.max_size'] = u'142'
     >>> request.form['submit'] = u''
-    >>> pprint(MyForm(order, request)()) # doctest: +NORMALIZE_WHITESPACE
+    >>> values = MyForm(order, request)() # doctest: +NORMALIZE_WHITESPACE
     1
     <input class="textType" id="form.name" name="form.name" size="20"
            type="text" value="bob"  />
@@ -547,9 +544,8 @@
     <input class="textType" id="form.max_size" name="form.max_size" size="10"
            type="text" value="142.0"  />
     Object updated
-    {'max_size': 142.0,
-     'min_size': 42.0,
-     'name': u'bob'}
+    >>> sorted(values.items())
+    [('max_size', 142.0), ('min_size', 42.0), ('name', u'bob')]
 
     >>> order.name
     u'bob'
@@ -563,7 +559,7 @@
 Note, however, that if we submit the same request, we'll see that no
 changes were applied:
 
-    >>> pprint(MyForm(order, request)()) # doctest: +NORMALIZE_WHITESPACE
+    >>> values = MyForm(order, request)() # doctest: +NORMALIZE_WHITESPACE
     1
     <input class="textType" id="form.name" name="form.name" size="20"
            type="text" value="bob"  />
@@ -572,9 +568,8 @@
     <input class="textType" id="form.max_size" name="form.max_size" size="10"
            type="text" value="142.0"  />
     No changes
-    {'max_size': 142.0,
-     'min_size': 42.0,
-     'name': u'bob'}
+    >>> sorted(values.items())
+    [('max_size', 142.0), ('min_size', 42.0), ('name', u'bob')]
 
 because the new and old values are the same.
 



More information about the Zope3-Checkins mailing list