]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/auto_ptr.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)
5 >>> from auto_ptr_ext import *
19 >>> broken_auto_ptr and -1 or look(x)
25 >>> broken_auto_ptr and -1 or look(x)
28 >>> if not broken_auto_ptr:
30 ... except TypeError: pass
31 ... else: print('expected a TypeError exception')
37 >>> z = callback(lambda z: z)
41 >>> extract(x).value()
45 # Test derived to base conversions
52 >>> try: maybe_steal(y, 0)
53 ... except TypeError: pass
54 ... else: print('expected a TypeError exception')
59 >>> broken_auto_ptr and 42 or steal(y)
62 >>> if not broken_auto_ptr:
64 ... except TypeError: pass
65 ... else: print('expected a TypeError exception')
67 >>> print(look.__doc__.splitlines()[1])
68 look( (X)arg1) -> int :
70 >>> print(steal.__doc__.splitlines()[1])
71 steal( (X)arg1) -> int :
73 >>> print(maybe_steal.__doc__.splitlines()[1])
74 maybe_steal( (X)arg1, (bool)arg2) -> int :
76 >>> print(make.__doc__.splitlines()[1])
79 >>> print(callback.__doc__.splitlines()[1])
80 callback( (object)arg1) -> X :
82 >>> print(extract.__doc__.splitlines()[1])
83 extract( (object)arg1) -> X :
93 return doctest
.testmod(sys
.modules
.get(__name__
))
95 if __name__
== '__main__':
99 if (status
== 0): print("Done.")