]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/implicit.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / python / test / implicit.py
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 implicit_ext import *
6 >>> x_value(X(42))
7 42
8 >>> x_value(42)
9 42
10 >>> x = make_x(X(42))
11 >>> x.value()
12 42
13 >>> try: make_x('fool')
14 ... except TypeError: pass
15 ... else: print('no error')
16
17 >>> print(x_value.__doc__.splitlines()[1])
18 x_value( (X)arg1) -> int :
19
20 >>> print(make_x.__doc__.splitlines()[1])
21 make_x( (object)arg1) -> X :
22
23 >>> print(X.value.__doc__.splitlines()[1])
24 value( (X)arg1) -> int :
25
26 >>> print(X.set.__doc__.splitlines()[1])
27 set( (X)arg1, (object)arg2) -> None :
28
29 '''
30
31 def run(args = None):
32 import sys
33 import doctest
34
35 if args is not None:
36 sys.argv = args
37 return doctest.testmod(sys.modules.get(__name__))
38
39 if __name__ == '__main__':
40 print("running...")
41 import sys
42 status = run()[0]
43 if (status == 0): print("Done.")
44 sys.exit(status)