def test_vector_pickle(self): x = coda_types.VectorSizeT(tuple(range(10))) y = pickle.loads(pickle.dumps(x)) self.assertEqual(tuple(x), tuple(y)) x = coda_types.VectorRowColInt(tuple(coda_types.RowColInt(i + 1, i + 2) for i in range(10))) y = pickle.loads(pickle.dumps(x)) self.assertEqual(tuple(x), tuple(y))
def test_vector_pickle(self): x = coda_types.VectorSizeT(tuple(range(10))) y = pickle.loads(pickle.dumps(x)) self.assertEqual(tuple(x), tuple(y)) x = coda_types.VectorRowColInt(tuple(coda_types.RowColInt(i+1,i+2) for i in range(10))) y = pickle.loads(pickle.dumps(x)) self.assertEqual(tuple(x), tuple(y))
def test_RowCol_pickle(self): x = coda_types.RowColDouble(1.2, 3.4) y = pickle.loads(pickle.dumps(x)) self.assertEqual(x, y) x = coda_types.RowColInt(1, 2) y = pickle.loads(pickle.dumps(x)) self.assertEqual(x, y) x = coda_types.RowColSizeT(1, 2) y = pickle.loads(pickle.dumps(x)) self.assertEqual(x, y)
def __getstate__(self): """Recursive pickling method for SWIG-wrapped Poly2D.""" # Create a dictionary of parameters and values state = {} # Use swig_setmethods to get only data we can set later state['coeffs'] = pickle.dumps(self.coeffs()) return state
def __getstate__(self): # Return a nonempty (thus non-false) tuple with dummy value in first position return (-1, tuple(pickle.dumps(elem) for elem in self))
def test_RgAz_pickle(self): x = coda_types.RgAzDouble(1.2, 3.4) y = pickle.loads(pickle.dumps(x)) self.assertEqual(x, y)