2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-22 05:22:45 +00:00
Files
python/example/test_pickle1.py
Ralf W. Grosse-Kunstleve 012b4025a4 temp files before branching
[SVN r9549]
2001-03-13 00:01:06 +00:00

32 lines
781 B
Python

r'''>>> import pickle1
>>> import re
>>> import pickle
>>> pickle1.world.__module__
'pickle1'
>>> pickle1.world.__safe_for_unpickling__
1
>>> pickle1.world.__reduce__()
'world'
>>> assert re.match(
... "\(<extension class pickle1.world at [0-9a-fA-FxX]+>, \('Hello',\)\)",
... repr(pickle1.world('Hello').__reduce__()))
>>>
>>> wd = pickle1.world('California')
>>> pstr = pickle.dumps(wd)
>>> wl = pickle.loads(pstr)
>>> print wd.greet()
Hello from California!
>>> print wl.greet()
Hello from California!
'''
def run(args = None):
if args is not None:
import sys
sys.argv = args
import doctest, test_pickle1
doctest.testmod(test_pickle1)
if __name__ == '__main__':
run()