]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/test/properties.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 This is test module for properties.
7 >>> r = properties.ret_type()
11 >>> c = properties.crash_me()
31 class instance count read - only
35 class instance count direct
36 >>> X.instance_count_direct
39 class instance count injected
40 >>> X.instance_count_injected
43 class instance count from object
47 class instance count from object
48 >>> x1.instance_count_direct
51 class instance count from object:
52 >>> x1.instance_count_injected
55 as expected you can't assign new value to read only property
57 Traceback (most recent call last):
58 File "properties.py", line 49, in ?
60 AttributeError: can't set attribute
62 setting value_rw to 2. value_direct:
67 setting value_direct to 3. value_direct:
68 >>> x1.value_direct = 3
72 >>> assert x1.value_r == 3
76 after creating second intstance of X instances count is 2
81 >>> assert x1.instance_count == 1
83 >>> assert properties.X.value_r_ds.__doc__ == "value_r_ds is read-only"
85 >>> assert properties.X.value_rw_ds.__doc__ == "value_rw_ds is read-write"
89 #import sys; sys.path.append(r'P:\Actimize4.0\smart_const\py_smart_const___Win32_Debug')
90 import properties_ext
as properties
99 return doctest
.testmod(sys
.modules
.get(__name__
))
101 if __name__
== '__main__':
105 if (status
== 0): print("Done.")