Skip to content

Commit

Permalink
Extend the test case to cover resetting an existing key both on empty…
Browse files Browse the repository at this point in the history
… and on two.
  • Loading branch information
jamadden committed Apr 7, 2015
1 parent 141c28a commit dfd79e8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions BTrees/tests/common.py
Expand Up @@ -1114,12 +1114,33 @@ def register(self, arg):

t._p_jar = Jar()
t[1] = 3
# reset these, setting _firstbucket triggered a change
t._p_changed = False
t._p_jar.registered = None
t[2] = 4
self.assertTrue(t._p_changed)
self.assertEqual(t, t._p_jar.registered)

# Setting the same key to a different value also triggers a change
t._p_changed = False
t._p_jar.registered = None
t[2] = 5
self.assertTrue(t._p_changed)
self.assertEqual(t, t._p_jar.registered)

# Likewise with only a single value
t = self._makeOne()
t._p_oid = b'\0\0\0\0\0'
t._p_jar = Jar()
t[1] = 3
# reset these, setting _firstbucket triggered a change
t._p_changed = False
t._p_jar.registered = None

t[1] = 6
self.assertTrue(t._p_changed)
self.assertEqual(t, t._p_jar.registered)

class NormalSetTests(Base):
# Test common to all set types

Expand Down

0 comments on commit dfd79e8

Please sign in to comment.