[Zope-CVS] CVS: Products/Ape/lib/apelib/tests -
testserialization.py:1.8
Shane Hathaway
shane at zope.com
Fri Mar 26 11:08:03 EST 2004
Update of /cvs-repository/Products/Ape/lib/apelib/tests
In directory cvs.zope.org:/tmp/cvs-serv26608/lib/apelib/tests
Modified Files:
testserialization.py
Log Message:
All mapper events now have access to the classification.
Especially useful for debugging.
=== Products/Ape/lib/apelib/tests/testserialization.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/tests/testserialization.py:1.7 Sat Mar 20 01:34:24 2004
+++ Products/Ape/lib/apelib/tests/testserialization.py Fri Mar 26 11:08:01 2004
@@ -48,35 +48,43 @@
"""
def test_serialize_and_deserialize(self):
+ classification = None
ob = TestObject()
ob['a'] = 'b'
ob['c'] = 'd'
obj_db = None
m = self.conf.mappers["tm"]
- event = SerializationEvent(self.conf, m, '', obj_db, ob)
+ event = SerializationEvent(
+ self.conf, m, '', classification, obj_db, ob)
full_state = m.serializer.serialize(event)
ob2 = TestObject()
- event = DeserializationEvent(self.conf, m, '', obj_db, ob2)
+ event = DeserializationEvent(
+ self.conf, m, '', classification, obj_db, ob2)
m.serializer.deserialize(event, full_state)
self.assertEqual(ob.strdata, ob2.strdata)
self.assertEqual(ob.data, ob2.data)
def test_store_and_load(self):
+ classification = None
ob = TestObject()
ob.strdata = '345'
ob['a'] = 'b'
ob['c'] = 'd'
obj_db = None
m = self.conf.mappers["tm"]
- event = SerializationEvent(self.conf, m, '', obj_db, ob)
+ event = SerializationEvent(
+ self.conf, m, '', classification, obj_db, ob)
full_state = m.serializer.serialize(event)
- event = StoreEvent(self.conf, m, '', self.conns, None, True)
+ event = StoreEvent(
+ self.conf, m, '', classification, self.conns, True)
m.gateway.store(event, full_state)
- event = LoadEvent(self.conf, m, '', self.conns, None)
+ event = LoadEvent(
+ self.conf, m, '', classification, self.conns)
full_state, serial = m.gateway.load(event)
ob2 = TestObject()
- event = DeserializationEvent(self.conf, m, '', obj_db, ob2)
+ event = DeserializationEvent(
+ self.conf, m, '', classification, obj_db, ob2)
m.serializer.deserialize(event, full_state)
self.assertEqual(ob.strdata, ob2.strdata)
self.assertEqual(ob.data, ob2.data)
@@ -84,34 +92,41 @@
def test_catch_extra_attribute(self):
# The mapper for PersistentMappings doesn't allow an
# extra attribute.
+ classification = None
ob = PersistentMapping()
ob.extra = '678'
ob['a'] = 'b'
ob['c'] = 'd'
obj_db = MockObjectDatabase()
m = self.conf.mappers["pm"]
- event = SerializationEvent(self.conf, m, '', obj_db, ob)
+ event = SerializationEvent(
+ self.conf, m, '', classification, obj_db, ob)
self.assertRaises(SerializationError, m.serializer.serialize, event)
def test_shared_attribute(self):
# Test of an attribute shared between a normal serializer and
# a remainder serializer.
+ classification = None
ob = TestObject()
data = SimpleClass('This is a shared piece of data')
ob.extra = data
ob['a'] = data
obj_db = None
m = self.conf.mappers["tm"]
- event = SerializationEvent(self.conf, m, '', obj_db, ob)
+ event = SerializationEvent(
+ self.conf, m, '', classification, obj_db, ob)
full_state = m.serializer.serialize(event)
- event = StoreEvent(self.conf, m, '', self.conns, None, True)
+ event = StoreEvent(
+ self.conf, m, '', classification, self.conns, True)
m.gateway.store(event, full_state)
# Now load the state into a different object
- event = LoadEvent(self.conf, m, '', self.conns, None)
+ event = LoadEvent(
+ self.conf, m, '', classification, self.conns)
full_state, serial = m.gateway.load(event)
ob2 = TestObject()
- event = DeserializationEvent(self.conf, m, '', obj_db, ob2)
+ event = DeserializationEvent(
+ self.conf, m, '', classification, obj_db, ob2)
m.serializer.deserialize(event, full_state)
self.assertEqual(ob.extra.data, ob2.extra.data)
self.assertEqual(ob.keys(), ob2.keys())
More information about the Zope-CVS
mailing list