diff options
-rw-r--r-- | tests/samplebinding/copy_test.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/samplebinding/copy_test.py b/tests/samplebinding/copy_test.py index 3a0ff1876..e347182af 100644 --- a/tests/samplebinding/copy_test.py +++ b/tests/samplebinding/copy_test.py @@ -29,6 +29,12 @@ import copy import unittest +try: + import cPickle as pickle +except ImportError: + import pickle + + from sample import Point @@ -55,6 +61,21 @@ class DeepCopy(unittest.TestCase): self.assertEqual(point, new_point) +class PicklingTest(unittest.TestCase): + '''Support pickling''' + + def testSimple(self): + '''Simple pickling and unpickling''' + + point = Point(10.2, 43.5) + + data = pickle.dumps(point) + new_point = pickle.loads(data) + + self.assertEqual(point, new_point) + self.assert_(point is not new_point) + + if __name__ == '__main__': unittest.main() |