Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(207830)

Delta Between Two Patch Sets: Lib/test/test_property.py

Issue 11610: Improving property to accept abstract methods
Left Patch Set: Created 8 years ago
Right Patch Set: Created 8 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Lib/test/test_abc.py ('k') | Misc/ACKS » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # Test case for property 1 # Test case for property
2 # more tests are in test_descr 2 # more tests are in test_descr
3 3
4 import sys 4 import sys
5 import unittest 5 import unittest
6 from test.support import run_unittest 6 from test.support import run_unittest
7 7
8 class PropertyBase(Exception): 8 class PropertyBase(Exception):
9 pass 9 pass
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 def __nonzero__(self): 143 def __nonzero__(self):
144 raise ValueError() 144 raise ValueError()
145 __len__ = __nonzero__ 145 __len__ = __nonzero__
146 with self.assertRaises(ValueError): 146 with self.assertRaises(ValueError):
147 class C(object): 147 class C(object):
148 def foo(self): 148 def foo(self):
149 pass 149 pass
150 foo.__isabstractmethod__ = NotBool() 150 foo.__isabstractmethod__ = NotBool()
151 foo = property(foo) 151 foo = property(foo)
152 C.foo.__isabstractmethod__ 152 C.foo.__isabstractmethod__
153
154 153
155 154
156 # Issue 5890: subclasses of property do not preserve method __doc__ strings 155 # Issue 5890: subclasses of property do not preserve method __doc__ strings
157 class PropertySub(property): 156 class PropertySub(property):
158 """This is a subclass of property""" 157 """This is a subclass of property"""
159 158
160 class PropertySubSlots(property): 159 class PropertySubSlots(property):
161 """This is a subclass of property that defines __slots__""" 160 """This is a subclass of property that defines __slots__"""
162 __slots__ = () 161 __slots__ = ()
163 162
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 return 2 245 return 2
247 self.assertEqual(Foo.spam.__doc__, "a new docstring") 246 self.assertEqual(Foo.spam.__doc__, "a new docstring")
248 247
249 248
250 249
251 def test_main(): 250 def test_main():
252 run_unittest(PropertyTests, PropertySubclassTests) 251 run_unittest(PropertyTests, PropertySubclassTests)
253 252
254 if __name__ == '__main__': 253 if __name__ == '__main__':
255 test_main() 254 test_main()
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+