]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/opaque.py
1 # -*- coding: utf-8 -*-
2 # Copyright Gottfried Ganßauge 2003..2006. Distributed under the Boost
3 # Software License, Version 1.0. (See accompanying
4 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 >>> from opaque_ext import *
11 Check for correct conversion
15 Check that None is converted to a NULL opaque pointer
22 Check that we don't lose type information by converting NULL
23 opaque pointers to None
25 >>> assert getnull() is None
30 Traceback (most recent call last):
34 Check that there is no conversion from integers ...
37 ... except TypeError: pass
38 ... else: print('expected a TypeError')
40 ... and from strings to opaque objects
43 ... except TypeError: pass
44 ... else: print('expected a TypeError')
46 Now check the same for another opaque pointer type
50 Traceback (most recent call last):
54 ... except TypeError: pass
55 ... else: print('expected a TypeError')
57 ... except TypeError: pass
58 ... else: print('expected a TypeError')
60 Check that opaque types are distinct
63 ... except TypeError: pass
64 ... else: print('expected a TypeError')
66 ... except TypeError: pass
67 ... else: print('expected a TypeError')
69 This used to result in a segmentation violation
71 >>> type(get()) != type (get2())
80 return doctest
.testmod(sys
.modules
.get(__name__
))
82 if __name__
== '__main__':
86 if (status
== 0): print("Done.")