[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/container/tests/test_icontainer.py Changed indentation of DefaultTestData() to 4 spaces; it confused Emacs.

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jul 9 11:46:00 EDT 2004


Log message for revision 26326:

Changed indentation of DefaultTestData() to 4 spaces; it confused Emacs.

Fixed a test to be more general.




-=-
Modified: Zope3/trunk/src/zope/app/container/tests/test_icontainer.py
===================================================================
--- Zope3/trunk/src/zope/app/container/tests/test_icontainer.py	2004-07-09 15:45:58 UTC (rev 26325)
+++ Zope3/trunk/src/zope/app/container/tests/test_icontainer.py	2004-07-09 15:46:00 UTC (rev 26326)
@@ -22,8 +22,8 @@
 
 
 def DefaultTestData():
-        return [('3', '0'), ('2', '1'), ('4', '2'), ('6', '3'), ('0', '4'),
-                ('5', '5'), ('1', '6'), ('8', '7'), ('7', '8'), ('9', '9')]
+    return [('3', '0'), ('2', '1'), ('4', '2'), ('6', '3'), ('0', '4'),
+            ('5', '5'), ('1', '6'), ('8', '7'), ('7', '8'), ('9', '9')]
 
 class BaseTestIContainer(PlacelessSetup):
     """Base test cases for containers.
@@ -84,14 +84,14 @@
         self.assertEqual(list(values), [])
 
         container, data = self.__setUp()
-        values = container.values()
-        # XXX: this assumes that sort produces a deterministic order for
-        # the data returned by container.  This is valid for the data
-        # in DefaultTestData, but it may not be valid for all IContainers.
-        # Is there a better way to write this test?
-        values = list(values); values.sort() # convert to sorted list
-        ivalues = [ v for k, v in data ]; ivalues.sort() # sort original.
-        self.assertEqual(values, ivalues)
+        values = list(container.values())
+        for k, v in data:
+            try:
+                values.remove(v)
+            except ValueError:
+                self.fail('Value not in list')
+                
+        self.assertEqual(values, [])
 
     def test_len(self):
         # See interface IReadContainer



More information about the Zope3-Checkins mailing list