def testZodbObjectState(self): state = ZodbObjectState(self.obj) self.assertEquals(state.listItems(), None) self.assertTrue(state.listAttributes()[0][0], '_SampleContainer__data') self.assertEquals(state.getParent(), None) self.assertEquals(state.getName(), None) self.assertTrue('_SampleContainer__data' in state.asDict().keys())
def testZodbObjectState(self): state = ZodbObjectState(self.obj) self.assertEqual(state.getError(), None) self.assertEqual(state.listItems(), None) self.assertEqual( list(state.listAttributes())[0][0], '_SampleContainer__data') self.assertEqual(state.getParent(), None) self.assertEqual(state.getParentState(), None) self.assertEqual(state.getName(), None) self.assertTrue('_SampleContainer__data' in state.asDict().keys())
def _loadHistoricalState(self): results = [] for d in self.history: try: interp = ZodbObjectState(self.obj, d['tid'], _history=self.history) state = interp.asDict() error = interp.getError() except Exception, e: state = {} error = '%s: %s' % (e.__class__.__name__, e) results.append(dict(state=state, error=error))
def _loadHistoricalState(self): results = [] for d in self.history: try: interp = ZodbObjectState(self.obj, d['tid'], _history=self.history) state = interp.asDict() error = interp.getError() except Exception as e: state = {} error = '%s: %s' % (e.__class__.__name__, e) results.append(dict(state=state, error=error)) results.append(dict(state={}, error=None)) return results