]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Daniel Wallin 2006. Distributed under the |
2 | # Boost Software License, Version 1.0. (See accompanying file | |
3 | # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | ''' | |
6 | >>> from python_test_ext import X | |
7 | >>> x = X(y = 'baz') | |
8 | >>> x.value | |
9 | 'foobaz' | |
10 | >>> x.f(1,2) | |
11 | 3 | |
12 | >>> x.f(1,2,3) | |
13 | 6 | |
14 | >>> x.f(1,2, z = 3) | |
15 | 6 | |
16 | >>> x.f(z = 3, y = 2, x = 1) | |
17 | 6 | |
18 | >>> x.g() | |
19 | 'foobar' | |
20 | >>> x.g(y = "baz") | |
21 | 'foobaz' | |
22 | >>> x.g(x = "baz") | |
23 | 'bazbar' | |
24 | >>> x.g(y = "foo", x = "bar") | |
25 | 'barfoo' | |
26 | >>> y = x.h(x = "bar", y = "foo") | |
27 | >>> assert x == y | |
28 | >>> y = x(0) | |
29 | >>> assert x == y | |
30 | ''' | |
31 | ||
32 | def run(args = None): | |
33 | if args is not None: | |
34 | import sys | |
35 | sys.argv = args | |
36 | import doctest, python_test | |
37 | return doctest.testmod(python_test) | |
38 | ||
39 | if __name__ == '__main__': | |
40 | import sys | |
41 | sys.exit(run()[0]) |