[Checkins] SVN: BTrees/branches/pure_python/ Tests expect TypeError for items which aren't seq-of-2-tuples.

Tres Seaver cvs-admin at zope.org
Fri Nov 16 23:00:18 UTC 2012


Log message for revision 128318:
  Tests expect TypeError for items which aren't seq-of-2-tuples.

Changed:
  _U  BTrees/branches/pure_python/
  U   BTrees/branches/pure_python/BTrees/_base.py

-=-
Modified: BTrees/branches/pure_python/BTrees/_base.py
===================================================================
--- BTrees/branches/pure_python/BTrees/_base.py	2012-11-16 20:21:25 UTC (rev 128317)
+++ BTrees/branches/pure_python/BTrees/_base.py	2012-11-16 23:00:17 UTC (rev 128318)
@@ -212,8 +212,11 @@
             items = items.items()
 
         _si = self.__setitem__
-        for key, value in items:
-            _si(key, value)
+        try:
+            for key, value in items:
+                _si(key, value)
+        except ValueError:
+            raise TypeError('items must be a sequence of 2-tuples')
 
     def __setitem__(self, key, value):
         # Enforce test that key has non-default comparison.



More information about the checkins mailing list