[Checkins] SVN: BTrees/branches/pure_python/ Coverage.
Tres Seaver
cvs-admin at zope.org
Tue Dec 4 21:49:43 UTC 2012
Log message for revision 128517:
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:42 UTC (rev 128516)
+++ BTrees/branches/pure_python/BTrees/tests/test__base.py 2012-12-04 21:49:43 UTC (rev 128517)
@@ -2625,6 +2625,22 @@
rhs = {'b': 22, 'd': 14}
self.assertRaises(TypeError, self._callFUT, lhs.__class__, lhs, rhs)
+ def test_lhs_mergeable_set_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.MERGE_DEFAULT = 1
+ lhs._mapping_type = _Mapping
+ rhs = self._makeMapping({'a': 13, 'b': 12, 'c': 11})
+ weight, result = self._callFUT(lhs.__class__, lhs, rhs)
+ self.assertEqual(weight, 1)
+ self.assertTrue(isinstance(result, _Mapping))
+ self.assertEqual(list(result), ['a', 'b', 'c', 'd'])
+ self.assertEqual(result['a'], 14)
+ self.assertEqual(result['b'], 12)
+ self.assertEqual(result['c'], 11)
+ self.assertEqual(result['d'], 1)
+
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