Skip to content

Commit

Permalink
100% coverage for btree.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Jul 27, 2017
1 parent df304d6 commit ff79491
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/zope/container/tests/test_btree.py
Expand Up @@ -34,9 +34,13 @@ def makeTestObject(self):
class TestBTreeSpecials(unittest.TestCase):

def testStoredLength(self):
# This is lazy for backward compatibility. If the len is not
# This is a lazy property for backward compatibility. If the len is not
# stored already we set it to the length of the underlying
# btree.
lazy = BTreeContainer._BTreeContainer__len
self.assertIs(lazy, BTreeContainer.__dict__['_BTreeContainer__len'])
self.assertTrue(hasattr(lazy, '__get__'))

bc = BTreeContainer()
self.assertEqual(bc.__dict__['_BTreeContainer__len'](), 0)
del bc.__dict__['_BTreeContainer__len']
Expand All @@ -45,6 +49,12 @@ def testStoredLength(self):
self.assertEqual(len(bc), 1)
self.assertEqual(bc.__dict__['_BTreeContainer__len'](), 1)

del bc.__dict__['_BTreeContainer__len']
self.assertFalse('_BTreeContainer__len' in bc.__dict__)
self.assertEqual(len(bc), 1)
self.assertEqual(bc.__dict__['_BTreeContainer__len'](), 1)


# The tests which follow test the additional signatures and declarations
# for the BTreeContainer that allow it to provide the IBTreeContainer
# interface.
Expand Down

0 comments on commit ff79491

Please sign in to comment.