[Checkins] SVN: z3c.form/trunk/ rewrite 2 tests to avoid pprint, which sorts dictionaries differently in Python 2.4 and 2.5+

David Glick davidglick at onenw.org
Fri Feb 26 22:54:48 EST 2010


Log message for revision 109481:
  rewrite 2 tests to avoid pprint, which sorts dictionaries differently in Python 2.4 and 2.5+

Changed:
  U   z3c.form/trunk/CHANGES.txt
  U   z3c.form/trunk/src/z3c/form/field.txt
  U   z3c.form/trunk/src/z3c/form/form.txt

-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt	2010-02-27 03:04:19 UTC (rev 109480)
+++ z3c.form/trunk/CHANGES.txt	2010-02-27 03:54:47 UTC (rev 109481)
@@ -5,6 +5,9 @@
 2.3.3 (unreleased)
 ------------------
 
+- Fix trivial test failures on Python 2.4 stemming from differences in
+  pprint's sorting of dicts.
+
 - Don't invoke render() when publishing the form as a view if the HTTP status
   code has been set to one in the 3xx range (e.g. a redirect or not-modified
   response) - the response body will be ignored by the browser anyway.

Modified: z3c.form/trunk/src/z3c/form/field.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/field.txt	2010-02-27 03:04:19 UTC (rev 109480)
+++ z3c.form/trunk/src/z3c/form/field.txt	2010-02-27 03:54:47 UTC (rev 109481)
@@ -704,9 +704,13 @@
   >>> manager.ignoreContext = True
   >>> manager.update()
 
-  >>> from pprint import pprint
-  >>> pprint(manager.extract())
-  ({'firstName': u'Stephan', 'lastName': u'Richter'}, ())
+  >>> data, errors = manager.extract()
+  >>> data['firstName']
+  u'Stephan'
+  >>> data['lastName']
+  u'Richter'
+  >>> errors
+  ()
 
 Since all errors are immediately converted to error view snippets, we have to
 provide the adapter from a validation error to an error view snippet first:

Modified: z3c.form/trunk/src/z3c/form/form.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/form.txt	2010-02-27 03:04:19 UTC (rev 109480)
+++ z3c.form/trunk/src/z3c/form/form.txt	2010-02-27 03:54:47 UTC (rev 109481)
@@ -1119,12 +1119,16 @@
   >>> editForm = PersonDictEditForm(None, request)
   >>> editForm.update()
 
-  >>> from pprint import pprint
-  >>> pprint(personDict)
-  {'age': 5,
-   'gender': 'male',
-   'id': u'rineichen',
-   'name': u'Jesse Ineichen'}
+  >>> len(personDict)
+  4
+  >>> personDict['age']
+  5
+  >>> personDict['gender']
+  'male'
+  >>> personDict['id']
+  u'rineichen'
+  >>> personDict['name']
+  u'Jesse Ineichen'
 
 
 Creating a Display Form



More information about the checkins mailing list