[Checkins] SVN: BTrees/branches/pure_python/ Coverage.

Tres Seaver cvs-admin at zope.org
Tue Dec 4 21:49:44 UTC 2012


Log message for revision 128519:
  Coverage.

Changed:
  _U  BTrees/branches/pure_python/
  U   BTrees/branches/pure_python/BTrees/tests/test__base.py

-=-
Modified: BTrees/branches/pure_python/BTrees/tests/test__base.py
===================================================================
--- BTrees/branches/pure_python/BTrees/tests/test__base.py	2012-12-04 21:49:43 UTC (rev 128518)
+++ BTrees/branches/pure_python/BTrees/tests/test__base.py	2012-12-04 21:49:44 UTC (rev 128519)
@@ -2717,6 +2717,27 @@
         lhs = self._makeMapping({'a': 13, 'c': 12, 'e': 11})
         self.assertEqual(self._callFUT(lhs.__class__, lhs, None), (1, lhs))
 
+    def test_both_mappings_but_no_merge(self):
+        lhs = {'a': 13, 'b': 12, 'c': 11}
+        rhs = {'b': 22, 'd': 14}
+        self.assertRaises(TypeError, self._callFUT, lhs.__class__, lhs, rhs)
+
+    def test_lhs_set_wo_MERGE_DEFAULT_rhs_set(self):
+        lhs = self._makeSet('a', 'd')
+        lhs.MERGE = lambda v1, w1, v2, w2: (v1 * w1) + (v2 * w2)
+        lhs.MERGE_WEIGHT = lambda v, w: v
+        lhs._mapping_type = _Mapping
+        rhs = self._makeSet('a', 'b', 'c')
+        self.assertRaises(TypeError, self._callFUT, lhs.__class__, lhs, rhs)
+
+    def test_lhs_set_wo_MERGE_DEFAULT_rhs_mapping(self):
+        lhs = self._makeSet('a', 'd')
+        lhs.MERGE = lambda v1, w1, v2, w2: (v1 * w1) + (v2 * w2)
+        lhs.MERGE_WEIGHT = lambda v, w: v
+        lhs._mapping_type = _Mapping
+        rhs = self._makeMapping({'a': 13, 'b': 12, 'c': 11})
+        self.assertRaises(TypeError, self._callFUT, lhs.__class__, lhs, rhs)
+
     def test_lhs_mapping_rhs_set(self):
         lhs = self._makeMapping({'a': 13, 'b': 12, 'c': 11})
         rhs = self._makeSet('a', 'd')



More information about the checkins mailing list