1# Copyright David Abrahams 2004. Distributed under the Boost
2# Software License, Version 1.0. (See accompanying
3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4r'''>>> import pickle1_ext
5    >>> import pickle
6    >>> pickle1_ext.world.__module__
7    'pickle1_ext'
8    >>> pickle1_ext.world.__safe_for_unpickling__
9    1
10    >>> pickle1_ext.world.__name__
11    'world'
12    >>> pickle1_ext.world('Hello').__reduce__()
13    (<class 'pickle1_ext.world'>, ('Hello',))
14    >>> wd = pickle1_ext.world('California')
15    >>> pstr = pickle.dumps(wd)
16    >>> wl = pickle.loads(pstr)
17    >>> print(wd.greet())
18    Hello from California!
19    >>> print(wl.greet())
20    Hello from California!
21
22    >>> noop = pickle1_ext.noop()
23    >>> try: pickle.dumps(noop)
24    ... except RuntimeError as e: print(str(e)[:55])
25    Pickling of "pickle1_ext.noop" instances is not enabled
26'''
27
28def run(args = None):
29    import sys
30    import doctest
31
32    if args is not None:
33        sys.argv = args
34    return doctest.testmod(sys.modules.get(__name__))
35
36if __name__ == '__main__':
37    print("running...")
38    import sys
39    status = run()[0]
40    if (status == 0): print("Done.")
41    sys.exit(status)
42