]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/aligned_class.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / python / test / aligned_class.py
1 # 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 aligned_class_ext import *
6
7 Ensure sanity:
8
9 >>> x = X(42, 16)
10 >>> x_function(x)
11 42
12 >>> f_function(x)
13 16.0
14
15 Demonstrate extraction in the presence of metaclass changes:
16
17 >>> class MetaX(X.__class__):
18 ... def __new__(cls, *args):
19 ... return super(MetaX, cls).__new__(cls, *args)
20 >>> class XPlusMetatype(X):
21 ... __metaclass__ = MetaX
22 >>> x = XPlusMetatype(42, 16)
23 >>> x_function(x)
24 42
25 >>> f_function(x)
26 16.0
27
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)