Commit b3f5da74 authored by Jason Madden's avatar Jason Madden

Test the error message for setting a oid for consistencey between c and python.

parent 5e5c5540
...@@ -385,8 +385,7 @@ class Persistent(object): ...@@ -385,8 +385,7 @@ class Persistent(object):
except AttributeError: except AttributeError:
pass pass
else: else:
cache.update_object_size_estimation(self.__oid, cache.update_object_size_estimation(self.__oid, -1)
-1)
# See notes in PickleCache.sweep for why we have to do this # See notes in PickleCache.sweep for why we have to do this
cache._persistent_deactivate_ran = True cache._persistent_deactivate_ran = True
......
...@@ -115,8 +115,6 @@ class _Persistent_Base(object): ...@@ -115,8 +115,6 @@ class _Persistent_Base(object):
def test_assign_p_jar_w_new_jar(self): def test_assign_p_jar_w_new_jar(self):
inst, jar, OID = self._makeOneWithJar() inst, jar, OID = self._makeOneWithJar()
new_jar = self._makeJar() new_jar = self._makeJar()
def _test():
inst._p_jar = new_jar
try: try:
inst._p_jar = new_jar inst._p_jar = new_jar
except ValueError as e: except ValueError as e:
...@@ -143,9 +141,14 @@ class _Persistent_Base(object): ...@@ -143,9 +141,14 @@ class _Persistent_Base(object):
def test_assign_p_oid_w_invalid_oid(self): def test_assign_p_oid_w_invalid_oid(self):
inst, jar, OID = self._makeOneWithJar() inst, jar, OID = self._makeOneWithJar()
def _test():
try:
inst._p_oid = object() inst._p_oid = object()
self.assertRaises(ValueError, _test) except ValueError as e:
self.assertEqual(str(e), 'can not change _p_oid of cached object')
else:
self.fail("Should raise value error")
def test_assign_p_oid_w_valid_oid(self): def test_assign_p_oid_w_valid_oid(self):
from persistent.timestamp import _makeOctets from persistent.timestamp import _makeOctets
......
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