Rev | Line | |
---|
[12] | 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 | """ |
---|
| 5 | >>> from str_ext import * |
---|
| 6 | >>> def printer(*args): |
---|
| 7 | ... for x in args: print x, |
---|
| 8 | ... print |
---|
| 9 | ... |
---|
| 10 | >>> work_with_string(printer) |
---|
| 11 | ['this', 'is', 'a', 'demo', 'string'] |
---|
| 12 | ['this', 'is', 'a', 'demo string'] |
---|
| 13 | this<->is<->a<->demo<->string |
---|
| 14 | This is a demo string |
---|
| 15 | [ this is a demo string ] |
---|
| 16 | 2 |
---|
| 17 | this is a demo string |
---|
| 18 | this is a demo string |
---|
| 19 | ['this is a demo string'] |
---|
| 20 | this is a demo string |
---|
| 21 | THIS IS A DEMO STRING |
---|
| 22 | This Is A Demo String |
---|
| 23 | find |
---|
| 24 | 10 |
---|
| 25 | 10 3 5 |
---|
| 26 | 10 |
---|
| 27 | 10 |
---|
| 28 | expandtabs |
---|
| 29 | tab demo ! |
---|
| 30 | tab demo ! |
---|
| 31 | tab demo ! |
---|
| 32 | operators |
---|
| 33 | part1part2 |
---|
| 34 | this is a blabla string |
---|
| 35 | 18 |
---|
| 36 | 18 |
---|
| 37 | aaaaaaaaaaaaaaaaaaaaa |
---|
| 38 | """ |
---|
| 39 | |
---|
| 40 | def run(args = None): |
---|
| 41 | import sys |
---|
| 42 | import doctest |
---|
| 43 | |
---|
| 44 | if args is not None: |
---|
| 45 | sys.argv = args |
---|
| 46 | return doctest.testmod(sys.modules.get(__name__)) |
---|
| 47 | |
---|
| 48 | if __name__ == '__main__': |
---|
| 49 | print "running..." |
---|
| 50 | import sys |
---|
| 51 | status = run()[0] |
---|
| 52 | if (status == 0): print "Done." |
---|
| 53 | sys.exit(status) |
---|
Note: See
TracBrowser
for help on using the repository browser.