Commit f5db3d59 authored by Tres Seaver's avatar Tres Seaver

100% coverage for BTrees.fsBTree.

parent db4ea45e
......@@ -23,6 +23,10 @@ class fsBucketTests(unittest.TestCase):
def _makeOne(self, *args, **kw):
return self._getTargetClass()(*args, **kw)
def test_MERGE_WEIGHT(self):
bucket = self._makeOne()
self.assertEqual(bucket.MERGE_WEIGHT(42, 17), 42)
def test_toString(self):
bucket = self._makeOne([(c*2, c*6) for c in 'abcdef'])
self.assertEqual(bucket.toString(),
......@@ -33,6 +37,29 @@ class fsBucketTests(unittest.TestCase):
after = before.fromString(before.toString())
self.assertEqual(before.__getstate__(), after.__getstate__())
def test_fromString_empty(self):
before = self._makeOne([(c*2, c*6) for c in 'abcdef'])
after = before.fromString('')
self.assertEqual(after.__getstate__(), ((),))
def test_fromString_invalid(self):
bucket = self._makeOne([(c*2, c*6) for c in 'abcdef'])
self.assertRaises(ValueError, bucket.fromString, 'xxx')
class fsBTreeTests(unittest.TestCase):
def _getTargetClass(self):
from BTrees.fsBTree import fsBTree
return fsBTree
def _makeOne(self, *args, **kw):
return self._getTargetClass()(*args, **kw)
def test_MERGE_WEIGHT(self):
bucket = self._makeOne()
self.assertEqual(bucket.MERGE_WEIGHT(42, 17), 42)
def test_suite():
return unittest.TestSuite((
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment