[Zope-CVS] CVS: Products/AdaptableStorage/tests - SerialTestBase.py:1.5 testInterfaceImpl.py:1.2 testSerialization.py:1.4
Shane Hathaway
shane@zope.com
Mon, 9 Dec 2002 13:25:30 -0500
Update of /cvs-repository/Products/AdaptableStorage/tests
In directory cvs.zope.org:/tmp/cvs-serv24698/tests
Modified Files:
SerialTestBase.py testInterfaceImpl.py testSerialization.py
Log Message:
More sanitization and documentation:
- Renamed RecordSchema to FieldSchema and made the simpler schema classes
usable. This removed the need to always work with record sets when all
that is needed is a single value.
- Finally successfully abstracted away keychain generation. Now gateways
and serializers don't have to duplicate logic.
- Renamed IEventBase to IMapperEvent, created a derivative IAspectEvent, and
moved some of the methods of IMapperEvent to IAspectEvent.
ISerializationEvent and IDeserializationEvent now derive from IAspectEvent.
- Changed IGateways to expect IMapperEvents instead of a (mapper, keychain)
pair.
=== Products/AdaptableStorage/tests/SerialTestBase.py 1.4 => 1.5 ===
--- Products/AdaptableStorage/tests/SerialTestBase.py:1.4 Sat Dec 7 00:59:14 2002
+++ Products/AdaptableStorage/tests/SerialTestBase.py Mon Dec 9 13:25:29 2002
@@ -30,9 +30,9 @@
__implements__ = sfw.IAspectSerializer
- schema = sfw.RecordSchema()
- schema.addColumn('name')
- schema.addColumn('value')
+ schema = sfw.RowSequenceSchema()
+ schema.addField('name')
+ schema.addField('value')
def getSchema(self):
return self.schema
=== Products/AdaptableStorage/tests/testInterfaceImpl.py 1.1 => 1.2 ===
--- Products/AdaptableStorage/tests/testInterfaceImpl.py:1.1 Wed Nov 27 13:37:08 2002
+++ Products/AdaptableStorage/tests/testInterfaceImpl.py Mon Dec 9 13:25:29 2002
@@ -26,12 +26,16 @@
class InterfaceImplTests(unittest.TestCase):
def _testObjectImpl(self, c):
- impl = c.__implements__
- if isinstance(impl, ListType) or isinstance(impl, TupleType):
- for iface in impl:
- self._verify(iface, c)
- else:
- self._verify(impl, c)
+ try:
+ impl = c.__implements__
+ if isinstance(impl, ListType) or isinstance(impl, TupleType):
+ for iface in impl:
+ self._verify(iface, c)
+ else:
+ self._verify(impl, c)
+ except:
+ print 'Bad implementation of', repr(c)
+ raise
def _testAllInModule(self, m):
for attr, value in m.__dict__.items():
=== Products/AdaptableStorage/tests/testSerialization.py 1.3 => 1.4 ===
--- Products/AdaptableStorage/tests/testSerialization.py:1.3 Sat Dec 7 00:59:14 2002
+++ Products/AdaptableStorage/tests/testSerialization.py Mon Dec 9 13:25:29 2002
@@ -39,9 +39,9 @@
kos = self.getKeyedObjectSystem()
mapper = self.root_mapper.getSubMapper('test_mapper')
full_state, refs = mapper.getSerializer().serialize(
- mapper, '', ob, kos)
+ kos, mapper, '', ob)
ob2 = PersistentMapping()
- mapper.getSerializer().deserialize(mapper, '', ob2, kos, full_state)
+ mapper.getSerializer().deserialize(kos, mapper, '', ob2, full_state)
self.assertEqual(ob.strdata, ob2.strdata)
self.assertEqual(ob.items(), ob2.items())
@@ -53,11 +53,12 @@
kos = self.getKeyedObjectSystem()
mapper = self.root_mapper.getSubMapper('test_mapper')
full_state, refs = mapper.getSerializer().serialize(
- mapper, '', ob, kos)
- mapper.getGateway().store(mapper, '', full_state)
- full_state, serial = mapper.getGateway().load(mapper, '')
+ kos, mapper, '', ob)
+ event = sfw.MapperEvent(mapper, '')
+ mapper.getGateway().store(event, full_state)
+ full_state, serial = mapper.getGateway().load(event)
ob2 = PersistentMapping()
- mapper.getSerializer().deserialize(mapper, '', ob2, kos, full_state)
+ mapper.getSerializer().deserialize(kos, mapper, '', ob2, full_state)
self.assertEqual(ob.strdata, ob2.strdata)
self.assertEqual(ob.items(), ob2.items())
@@ -70,8 +71,8 @@
kos = self.getKeyedObjectSystem()
mapper = self.root_mapper.getSubMapper('test_mapper')
self.assertRaises(sfw.SerializationError,
- mapper.getSerializer().serialize, mapper,
- '', ob, kos)
+ mapper.getSerializer().serialize, kos, mapper,
+ '', ob)
if __name__ == '__main__':