Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/keywords_test.py @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.9 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'''
5>>> from keywords import *
6>>> f = Foo()
7>>> f.a(), f.b(), f.n()
8(0, 0.0, '')
9>>> f = Foo(1)
10>>> f.a(), f.b(), f.n()
11(1, 0.0, '')
12>>> f = Foo(1,1.0)
13>>> f.a(), f.b(), f.n()
14(1, 1.0, '')
15>>> f = Foo(1,1.0,"1")
16>>> f.a(), f.b(), f.n()
17(1, 1.0, '1')
18>>> f = Foo(a=1)
19>>> f.a(), f.b(), f.n()
20(1, 0.0, '')
21>>> f = Foo(b=1)
22>>> f.a(), f.b(), f.n()
23(0, 1.0, '')
24>>> f = Foo(n="1")
25>>> f.a(), f.b(), f.n()
26(0, 0.0, '1')
27>>> f = Foo(1,n="1")
28>>> f.a(), f.b(), f.n()
29(1, 0.0, '1')
30>>> f.set()
31>>> f.a(), f.b(), f.n()
32(0, 0.0, '')
33>>> f.set(1)
34>>> f.a(), f.b(), f.n()
35(1, 0.0, '')
36>>> f.set(1,1.0)
37>>> f.a(), f.b(), f.n()
38(1, 1.0, '')
39>>> f.set(1,1.0,"1")
40>>> f.a(), f.b(), f.n()
41(1, 1.0, '1')
42>>> f.set(a=1)
43>>> f.a(), f.b(), f.n()
44(1, 0.0, '')
45>>> f.set(b=1)
46>>> f.a(), f.b(), f.n()
47(0, 1.0, '')
48>>> f.set(n="1")
49>>> f.a(), f.b(), f.n()
50(0, 0.0, '1')
51>>> f.set(1,n="1")
52>>> f.a(), f.b(), f.n()
53(1, 0.0, '1')
54>>> f.set2(b=2.0,n="2",a=2)
55>>> f.a(), f.b(), f.n()
56(2, 2.0, '2')
57
58# lets see how badly we've broken the 'regular' functions
59>>> f = Bar()
60>>> f.a(), f.b(), f.n()
61(0, 0.0, '')
62>>> f = Bar(1)
63>>> f.a(), f.b(), f.n()
64(1, 0.0, '')
65>>> f = Bar(1,1.0)
66>>> f.a(), f.b(), f.n()
67(1, 1.0, '')
68>>> f = Bar(1,1.0,"1")
69>>> f.a(), f.b(), f.n()
70(1, 1.0, '1')
71>>> f.set()
72>>> f.a(), f.b(), f.n()
73(0, 0.0, '')
74>>> f.set(1)
75>>> f.a(), f.b(), f.n()
76(1, 0.0, '')
77>>> f.set(1,1.0)
78>>> f.a(), f.b(), f.n()
79(1, 1.0, '')
80>>> f.set(1,1.0,"1")
81>>> f.a(), f.b(), f.n()
82(1, 1.0, '1')
83'''
84
85
86
87
88def run(args = None):
89    import sys
90    import doctest
91
92    if args is not None:
93        sys.argv = args
94    return doctest.testmod(sys.modules.get(__name__))
95   
96if __name__ == '__main__':
97    print "running..."
98    import sys
99    status = run()[0]
100    if (status == 0): print "Done."
101    sys.exit(status)
102
Note: See TracBrowser for help on using the repository browser.