[pypy-svn] r9928 - pypy/dist/pypy/lib/test2
tismer at codespeak.net
tismer at codespeak.net
Sun Mar 20 16:49:28 CET 2005
Author: tismer
Date: Sun Mar 20 16:49:28 2005
New Revision: 9928
Added:
pypy/dist/pypy/lib/test2/test_pickle.py (contents, props changed)
Modified:
pypy/dist/pypy/lib/test2/test_obj.py
Log:
splitted test_obj into two
Modified: pypy/dist/pypy/lib/test2/test_obj.py
==============================================================================
--- pypy/dist/pypy/lib/test2/test_obj.py (original)
+++ pypy/dist/pypy/lib/test2/test_obj.py Sun Mar 20 16:49:28 2005
@@ -1,18 +1,5 @@
# -*- coding: iso-8859-1 -*-
import unittest, test.test_support
-import sys, cStringIO, pickle
-
-class Picklable(object):
- def __init__(self, a=5):
- self.a = a
- def __eq__(self, other):
- return self.a == other.a
- def __str__(self):
- return '%s(%r)' % (self.__class__.__name__, self.a)
-
-class PicklableSpecial2(Picklable):
- def __reduce__(self):
- return self.__class__, (self.a,)
class ObjectTest(unittest.TestCase):
@@ -28,18 +15,6 @@
l = range(5)
self.assertRaises(TypeError, hash, l)
- def _pickle_some(self, x):
- for proto in range(pickle.HIGHEST_PROTOCOL + 1):
- s = pickle.dumps(x, proto)
- y = pickle.loads(s)
- self.assertEqual(x, y)
-
- def test_pickle_plain(self):
- self._pickle_some(Picklable())
-
- def test_pickle_special2(self):
- self._pickle_some(PicklableSpecial2())
-
def test_main():
test.test_support.run_unittest(ObjectTest)
Added: pypy/dist/pypy/lib/test2/test_pickle.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/lib/test2/test_pickle.py Sun Mar 20 16:49:28 2005
@@ -0,0 +1,35 @@
+# -*- coding: iso-8859-1 -*-
+import unittest, test.test_support
+import pickle
+
+class Picklable(object):
+ def __init__(self, a=5):
+ self.a = a
+ def __eq__(self, other):
+ return self.a == other.a
+ def __str__(self):
+ return '%s(%r)' % (self.__class__.__name__, self.a)
+
+class PicklableSpecial2(Picklable):
+ def __reduce__(self):
+ return self.__class__, (self.a,)
+
+class PickleTest(unittest.TestCase):
+
+ def _pickle_some(self, x):
+ for proto in range(pickle.HIGHEST_PROTOCOL + 1):
+ s = pickle.dumps(x, proto)
+ y = pickle.loads(s)
+ self.assertEqual(x, y)
+
+ def test_pickle_plain(self):
+ self._pickle_some(Picklable())
+
+ def test_pickle_special2(self):
+ self._pickle_some(PicklableSpecial2())
+
+def test_main():
+ test.test_support.run_unittest(PickleTest)
+
+if __name__ == "__main__":
+ test_main()
More information about the Pypy-commit
mailing list