|
Last change
on this file since 44 was
29,
checked in by landauf, 17 years ago
|
|
updated boost from 1_33_1 to 1_34_1
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 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) |
|---|
| 4 | r'''>>> import pickle4_ext |
|---|
| 5 | >>> import pickle |
|---|
| 6 | >>> def world_getinitargs(self): |
|---|
| 7 | ... return (self.get_country(),) |
|---|
| 8 | >>> pickle4_ext.world.__getinitargs__ = world_getinitargs |
|---|
| 9 | >>> pickle4_ext.world.__module__ |
|---|
| 10 | 'pickle4_ext' |
|---|
| 11 | >>> pickle4_ext.world.__safe_for_unpickling__ |
|---|
| 12 | 1 |
|---|
| 13 | >>> pickle4_ext.world.__name__ |
|---|
| 14 | 'world' |
|---|
| 15 | >>> pickle4_ext.world('Hello').__reduce__() |
|---|
| 16 | (<class 'pickle4_ext.world'>, ('Hello',)) |
|---|
| 17 | >>> wd = pickle4_ext.world('California') |
|---|
| 18 | >>> pstr = pickle.dumps(wd) |
|---|
| 19 | >>> wl = pickle.loads(pstr) |
|---|
| 20 | >>> print wd.greet() |
|---|
| 21 | Hello from California! |
|---|
| 22 | >>> print wl.greet() |
|---|
| 23 | Hello from California! |
|---|
| 24 | ''' |
|---|
| 25 | |
|---|
| 26 | def run(args = None): |
|---|
| 27 | import sys |
|---|
| 28 | import doctest |
|---|
| 29 | |
|---|
| 30 | if args is not None: |
|---|
| 31 | sys.argv = args |
|---|
| 32 | return doctest.testmod(sys.modules.get(__name__)) |
|---|
| 33 | |
|---|
| 34 | if __name__ == '__main__': |
|---|
| 35 | print "running..." |
|---|
| 36 | import sys |
|---|
| 37 | status = run()[0] |
|---|
| 38 | if (status == 0): print "Done." |
|---|
| 39 | sys.exit(status) |
|---|
Note: See
TracBrowser
for help on using the repository browser.