]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/shared_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 shared_ptr_ext import *
7 Test that shared_ptr<Derived> can be converted to shared_ptr<Base>
13 >>> null_x # should be None
14 >>> identity(null_x) # should also be None
22 <class 'shared_ptr_ext.Y'>
24 <class 'shared_ptr_ext.YY'>
28 ... return -Z.v(self);
29 ... def __del__(self):
40 ... except TypeError: pass
41 ... else: 'print(expected a TypeError)'
63 ... except TypeError: pass
64 ... else: 'print(expected a TypeError)'
66 >>> Z.get() # should be None
68 >>> assert Z.get() is z # show that deleter introspection works
86 ... except TypeError: pass
87 ... else: 'print(expected a TypeError)'
117 def run(args
= None):
123 return doctest
.testmod(sys
.modules
.get(__name__
))
125 if __name__
== '__main__':
129 if (status
== 0): print("Done.")