]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | from __future__ import print_function | |
5 | """ | |
6 | >>> from str_ext import * | |
7 | >>> def printer(*args): | |
8 | ... for x in args: print(x, end='') | |
9 | ... print('') | |
10 | ... | |
11 | >>> work_with_string(printer) #doctest: +NORMALIZE_WHITESPACE | |
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 | [ this is a demo string ] | |
17 | 2 | |
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 | This Is A Demo String | |
24 | find | |
25 | 10 | |
26 | 10 3 5 | |
27 | 10 | |
28 | 10 | |
29 | expandtabs | |
30 | tab demo ! | |
31 | tab demo ! | |
32 | tab demo ! | |
33 | operators | |
34 | part1part2 | |
35 | this is a blabla string | |
36 | 18 | |
37 | 18 | |
38 | aaaaaaaaaaaaaaaaaaaaa | |
39 | """ | |
40 | ||
41 | def run(args = None): | |
42 | import sys | |
43 | import doctest | |
44 | ||
45 | if args is not None: | |
46 | sys.argv = args | |
47 | return doctest.testmod(sys.modules.get(__name__)) | |
48 | ||
49 | if __name__ == '__main__': | |
50 | print("running...") | |
51 | import sys | |
52 | status = run()[0] | |
53 | if (status == 0): print("Done.") | |
54 | sys.exit(status) |