Commit db4d354e authored by Tres Seaver's avatar Tres Seaver

Rename 'test_pickle.py' to 'cucumbers.py'.

It no longer contains tests, only examples to be pickled.
parent 871686e2
...@@ -7,12 +7,10 @@ machinery happy: ...@@ -7,12 +7,10 @@ machinery happy:
.. doctest:: .. doctest::
>>> import pickle >>> import pickle
>>> from persistent.tests.test_pickle import Simple >>> from persistent.tests.cucumbers import Simple
>>> from persistent.tests.test_pickle import print_dict >>> from persistent.tests.cucumbers import print_dict
>>> x = Simple('x', aaa=1, bbb='foo') >>> x = Simple('x', aaa=1, bbb='foo')
>>> print_dict(x.__dict__)
{'__name__': 'x', 'aaa': 1, 'bbb': 'foo'}
>>> print_dict(x.__getstate__()) >>> print_dict(x.__getstate__())
{'__name__': 'x', 'aaa': 1, 'bbb': 'foo'} {'__name__': 'x', 'aaa': 1, 'bbb': 'foo'}
...@@ -49,7 +47,7 @@ by overriding :meth:`__getnewargs__`, :meth:`__getstate__` and ...@@ -49,7 +47,7 @@ by overriding :meth:`__getnewargs__`, :meth:`__getstate__` and
.. doctest:: .. doctest::
>>> from persistent.tests.test_pickle import Custom >>> from persistent.tests.cucumbers import Custom
>>> x = Custom('x', 'y') >>> x = Custom('x', 'y')
>>> x.__getnewargs__() >>> x.__getnewargs__()
...@@ -82,7 +80,7 @@ ignores any slots which map onto the "persistent" namespace (prefixed with ...@@ -82,7 +80,7 @@ ignores any slots which map onto the "persistent" namespace (prefixed with
.. doctest:: .. doctest::
>>> import copy_reg >>> import copy_reg
>>> from persistent.tests.test_pickle import SubSlotted >>> from persistent.tests.cucumbers import SubSlotted
>>> x = SubSlotted('x', 'y', 'z') >>> x = SubSlotted('x', 'y', 'z')
Note that we haven't yet assiged a value to the ``s4`` attribute: Note that we haven't yet assiged a value to the ``s4`` attribute:
...@@ -131,7 +129,7 @@ themselves: ...@@ -131,7 +129,7 @@ themselves:
.. doctest:: .. doctest::
>>> from persistent.tests.test_pickle import SubSubSlotted >>> from persistent.tests.cucumbers import SubSubSlotted
>>> x = SubSubSlotted('x', 'y', 'z') >>> x = SubSubSlotted('x', 'y', 'z')
>>> d, s = x.__getstate__() >>> d, s = x.__getstate__()
...@@ -142,13 +140,13 @@ themselves: ...@@ -142,13 +140,13 @@ themselves:
>>> import pickle >>> import pickle
>>> pickle.loads(pickle.dumps(x)) == x >>> pickle.loads(pickle.dumps(x)) == x
1 True
>>> pickle.loads(pickle.dumps(x, 0)) == x >>> pickle.loads(pickle.dumps(x, 0)) == x
1 True
>>> pickle.loads(pickle.dumps(x, 1)) == x >>> pickle.loads(pickle.dumps(x, 1)) == x
1 True
>>> pickle.loads(pickle.dumps(x, 2)) == x >>> pickle.loads(pickle.dumps(x, 2)) == x
1 True
>>> x.s4 = 'spam' >>> x.s4 = 'spam'
>>> x.foo = 'bar' >>> x.foo = 'bar'
...@@ -161,11 +159,10 @@ themselves: ...@@ -161,11 +159,10 @@ themselves:
{'s1': 'x', 's2': 'y', 's3': 'z', 's4': 'spam'} {'s1': 'x', 's2': 'y', 's3': 'z', 's4': 'spam'}
>>> pickle.loads(pickle.dumps(x)) == x >>> pickle.loads(pickle.dumps(x)) == x
1 True
>>> pickle.loads(pickle.dumps(x, 0)) == x >>> pickle.loads(pickle.dumps(x, 0)) == x
1 True
>>> pickle.loads(pickle.dumps(x, 1)) == x >>> pickle.loads(pickle.dumps(x, 1)) == x
1 True
>>> pickle.loads(pickle.dumps(x, 2)) == x >>> pickle.loads(pickle.dumps(x, 2)) == x
1 True
...@@ -826,7 +826,7 @@ class _Persistent_Base(object): ...@@ -826,7 +826,7 @@ class _Persistent_Base(object):
def test_pickle_roundtrip_simple(self): def test_pickle_roundtrip_simple(self):
import pickle import pickle
# XXX s.b. 'examples' # XXX s.b. 'examples'
from persistent.tests.test_pickle import Simple from persistent.tests.cucumbers import Simple
inst = Simple('testing') inst = Simple('testing')
copy = pickle.loads(pickle.dumps(inst)) copy = pickle.loads(pickle.dumps(inst))
self.assertEqual(copy, inst) self.assertEqual(copy, inst)
...@@ -837,7 +837,7 @@ class _Persistent_Base(object): ...@@ -837,7 +837,7 @@ class _Persistent_Base(object):
def test_pickle_roundtrip_w_getnewargs_and_getstate(self): def test_pickle_roundtrip_w_getnewargs_and_getstate(self):
import pickle import pickle
# XXX s.b. 'examples' # XXX s.b. 'examples'
from persistent.tests.test_pickle import Custom from persistent.tests.cucumbers import Custom
inst = Custom('x', 'y') inst = Custom('x', 'y')
copy = pickle.loads(pickle.dumps(inst)) copy = pickle.loads(pickle.dumps(inst))
self.assertEqual(copy, inst) self.assertEqual(copy, inst)
...@@ -848,7 +848,7 @@ class _Persistent_Base(object): ...@@ -848,7 +848,7 @@ class _Persistent_Base(object):
def test_pickle_roundtrip_w_slots_missing_slot(self): def test_pickle_roundtrip_w_slots_missing_slot(self):
import pickle import pickle
# XXX s.b. 'examples' # XXX s.b. 'examples'
from persistent.tests.test_pickle import SubSlotted from persistent.tests.cucumbers import SubSlotted
inst = SubSlotted('x', 'y', 'z') inst = SubSlotted('x', 'y', 'z')
copy = pickle.loads(pickle.dumps(inst)) copy = pickle.loads(pickle.dumps(inst))
self.assertEqual(copy, inst) self.assertEqual(copy, inst)
...@@ -859,7 +859,7 @@ class _Persistent_Base(object): ...@@ -859,7 +859,7 @@ class _Persistent_Base(object):
def test_pickle_roundtrip_w_slots_filled_slot(self): def test_pickle_roundtrip_w_slots_filled_slot(self):
import pickle import pickle
# XXX s.b. 'examples' # XXX s.b. 'examples'
from persistent.tests.test_pickle import SubSlotted from persistent.tests.cucumbers import SubSlotted
inst = SubSlotted('x', 'y', 'z') inst = SubSlotted('x', 'y', 'z')
inst.s4 = 'a' inst.s4 = 'a'
copy = pickle.loads(pickle.dumps(inst)) copy = pickle.loads(pickle.dumps(inst))
...@@ -871,7 +871,7 @@ class _Persistent_Base(object): ...@@ -871,7 +871,7 @@ class _Persistent_Base(object):
def test_pickle_roundtrip_w_slots_and_empty_dict(self): def test_pickle_roundtrip_w_slots_and_empty_dict(self):
import pickle import pickle
# XXX s.b. 'examples' # XXX s.b. 'examples'
from persistent.tests.test_pickle import SubSubSlotted from persistent.tests.cucumbers import SubSubSlotted
inst = SubSubSlotted('x', 'y', 'z') inst = SubSubSlotted('x', 'y', 'z')
copy = pickle.loads(pickle.dumps(inst)) copy = pickle.loads(pickle.dumps(inst))
self.assertEqual(copy, inst) self.assertEqual(copy, inst)
...@@ -882,7 +882,7 @@ class _Persistent_Base(object): ...@@ -882,7 +882,7 @@ class _Persistent_Base(object):
def test_pickle_roundtrip_w_slots_and_filled_dict(self): def test_pickle_roundtrip_w_slots_and_filled_dict(self):
import pickle import pickle
# XXX s.b. 'examples' # XXX s.b. 'examples'
from persistent.tests.test_pickle import SubSubSlotted from persistent.tests.cucumbers import SubSubSlotted
inst = SubSubSlotted('x', 'y', 'z', foo='bar', baz='bam') inst = SubSubSlotted('x', 'y', 'z', foo='bar', baz='bam')
inst.s4 = 'a' inst.s4 = 'a'
copy = pickle.loads(pickle.dumps(inst)) copy = pickle.loads(pickle.dumps(inst))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment