Skip to content

Commit

Permalink
Merge bbeb7ca into 7b6c79b
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Sep 14, 2018
2 parents 7b6c79b + bbeb7ca commit f1db9a6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
21 changes: 17 additions & 4 deletions BTrees/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def testShortRepr(self):
t = self._makeOne()
for i in range(5):
t[i] = i
t._p_oid = b'12345678'
r = repr(t)
# Make sure the repr is **not* 10000 bytes long for a shrort bucket.
# (the buffer must be terminated when copied).
Expand All @@ -374,9 +375,15 @@ def testShortRepr(self):
self.assertTrue(r.startswith("BTrees"))
self.assertTrue(r.endswith(repr(t.items()) + ')'), r)
else:
self.assertEqual(r[:8], '<BTrees.')
# persistent-4.4 changed the default reprs, adding
# oid and jar reprs, but eliminating the module prefix
# in one implementation
self.assertIn('BTree object at', r)
self.assertIn('oid', r)
self.assertIn('12345678', r)

# Make sure it's the same between Python and C
self.assertTrue('Py' not in r)
self.assertNotIn('Py', r)

def testRepr(self):
# test the repr because buckets have a complex repr implementation
Expand Down Expand Up @@ -1379,6 +1386,7 @@ def testShortRepr(self):
t = self._makeOne()
for i in range(5):
t.add(i)
t._p_oid = b'12345678'
r = repr(t)
# Make sure the repr is **not* 10000 bytes long for a shrort bucket.
# (the buffer must be terminated when copied).
Expand All @@ -1387,9 +1395,14 @@ def testShortRepr(self):
if 'TreeSet' not in r:
self.assertTrue(r.endswith("Set(%r)" % t.keys()))
else:
self.assertEqual(r[:7], '<BTrees', r)
# persistent-4.4 changed the default reprs, adding
# oid and jar reprs, but eliminating the module prefix
# in one implementation
self.assertIn('TreeSet object at', r)
self.assertIn('oid', r)
self.assertIn('12345678', r)
# Make sure it's the same between Python and C
self.assertTrue('Py' not in r)
self.assertNotIn('Py', r)


def testInsertReturnsValue(self):
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
4.5.2 (unreleased)
------------------

- Nothing changed yet.
- Fix tests against persistent 4.4.


4.5.1 (2018-08-09)
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ def BTreeExtension(family):
]

TESTS_REQUIRE = [
# Our tests check for the new repr strings
# generated in persistent 4.4.
'persistent >= 4.4.2',
'transaction',
'zope.testrunner',
]
Expand Down

0 comments on commit f1db9a6

Please sign in to comment.