Back to index

python3.2  3.2.2
Public Member Functions | Private Attributes
test.test_property.PropertySubclassTests Class Reference

List of all members.

Public Member Functions

def test_slots_docstring_copy_exception
def test_docstring_copy
def test_property_setter_copies_getter_docstring
def test_property_new_getter_new_docstring

Private Attributes

 _spam

Detailed Description

Definition at line 140 of file test_property.py.


Member Function Documentation

Definition at line 156 of file test_property.py.

00156 
00157     def test_docstring_copy(self):
00158         class Foo(object):
00159             @PropertySub
00160             def spam(self):
00161                 """spam wrapped in property subclass"""
00162                 return 1
00163         self.assertEqual(
00164             Foo.spam.__doc__,
00165             "spam wrapped in property subclass")

Here is the call graph for this function:

Definition at line 201 of file test_property.py.

00201 
00202     def test_property_new_getter_new_docstring(self):
00203 
00204         class Foo(object):
00205             @PropertySub
00206             def spam(self):
00207                 """a docstring"""
00208                 return 1
00209             @spam.getter
00210             def spam(self):
00211                 """a new docstring"""
00212                 return 2
00213         self.assertEqual(Foo.spam.__doc__, "a new docstring")
00214         class FooBase(object):
00215             @PropertySub
00216             def spam(self):
00217                 """a docstring"""
00218                 return 1
00219         class Foo2(FooBase):
00220             @FooBase.spam.getter
00221             def spam(self):
00222                 """a new docstring"""
00223                 return 2
00224         self.assertEqual(Foo.spam.__doc__, "a new docstring")
00225 
00226 

Here is the call graph for this function:

Definition at line 168 of file test_property.py.

00168 
00169     def test_property_setter_copies_getter_docstring(self):
00170         class Foo(object):
00171             def __init__(self): self._spam = 1
00172             @PropertySub
00173             def spam(self):
00174                 """spam wrapped in property subclass"""
00175                 return self._spam
00176             @spam.setter
00177             def spam(self, value):
00178                 """this docstring is ignored"""
00179                 self._spam = value
00180         foo = Foo()
00181         self.assertEqual(foo.spam, 1)
00182         foo.spam = 2
00183         self.assertEqual(foo.spam, 2)
00184         self.assertEqual(
00185             Foo.spam.__doc__,
00186             "spam wrapped in property subclass")
00187         class FooSub(Foo):
00188             @Foo.spam.setter
00189             def spam(self, value):
00190                 """another ignored docstring"""
00191                 self._spam = 'eggs'
00192         foosub = FooSub()
00193         self.assertEqual(foosub.spam, 1)
00194         foosub.spam = 7
00195         self.assertEqual(foosub.spam, 'eggs')
00196         self.assertEqual(
00197             FooSub.spam.__doc__,
00198             "spam wrapped in property subclass")

Definition at line 142 of file test_property.py.

00142 
00143     def test_slots_docstring_copy_exception(self):
00144         try:
00145             class Foo(object):
00146                 @PropertySubSlots
00147                 def spam(self):
00148                     """Trying to copy this docstring will raise an exception"""
00149                     return 1
00150         except AttributeError:
00151             pass
00152         else:
00153             raise Exception("AttributeError not raised")


Member Data Documentation

Definition at line 170 of file test_property.py.


The documentation for this class was generated from the following file: