summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2010-07-20 15:32:58 -0300
committerrenatofilho <renato.filho@openbossa.org>2010-10-11 19:22:44 -0300
commit8d21f82291d2a7bc38da95c938450a68c7e7da12 (patch)
treeef7d744cf0ae1308c03fe2fc1a1820fa29537fc8 /tests
parent6deb06937a34e7ef51098336e0541e543d51b8e0 (diff)
downloadshiboken-8d21f82291d2a7bc38da95c938450a68c7e7da12.tar.gz
shiboken-8d21f82291d2a7bc38da95c938450a68c7e7da12.tar.xz
shiboken-8d21f82291d2a7bc38da95c938450a68c7e7da12.zip
Adding pickling test
Reviewer: Renato Ara├║jo <renato.filho@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/samplebinding/copy_test.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/samplebinding/copy_test.py b/tests/samplebinding/copy_test.py
index 3a0ff187..e347182a 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()