@@ -0,0 +1,1568 @@
+#!/usr/bin/python%0A#%0A# This tests the property decorator in kaa.utils, which is designed to be%0A# forward-compatible with Python 2.6 and Python 3.0.  Demonstrates propety%0A# getters, setters, and deleters, with inheritance.%0A#%0A# See:%0A#   http://bugs.python.org/issue1416%0A#   http://permalink.gmane.org/gmane.comp.python.general/551183%0A#   http://bugs.python.org/issue1620%0A%0Afrom kaa.utils import property%0A%0Aclass A(object):%0A    def __init__(self):%0A        self._readonly = 42%0A        self._writable = 0%0A%0A    @property%0A    def readonly(self):%0A        %22readonly docstring%22%0A        return self._readonly%0A%0A    @property%0A    def writable(self):%0A        return self._writable%0A%0A    @writable.setter%0A    def writable(self, value):%0A        self._writable = value%0A%0A%0Aclass B(A):%0A    @A.readonly.getter%0A    def readonly(self):%0A        %22subclass readonly docstring%22%0A        return super(B, self).readonly * 2%0A%0A    @readonly.setter%0A    def readonly(self, value):%0A        # Ok, not exactly readonly anymore :)%0A        self._readonly = value%0A%0A    @A.writable.deleter%0A    def writable(self):%0A        self._writable = None%0A%0A%0Aa = A()%0Aassert(a.readonly == 42)%0Atry:%0A    a.readonly = 0%0Aexcept AttributeError:%0A    pass%0Aelse:%0A    raise AttributeError('a.readonly was writable')%0A%0Aa.writable = a.readonly / 2%0Aassert(a.writable == 21)%0A%0Aassert(A.readonly.__doc__ == 'readonly docstring')%0A%0Ab = B()%0Aassert(b.readonly == 42*2)%0Ab.readonly = 20%0Aassert(b.readonly == 20*2)%0Adel b.writable%0Aassert(b.writable is None)%0A%0Aassert(B.readonly.__doc__ == 'subclass readonly docstring')%0Aprint 'All property tests ok.'%0A%0A

Test for kaa.utils.property