diff options
author | Georg Brandl <georg@python.org> | 2006-03-08 18:09:27 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-08 18:09:27 (GMT) |
commit | 533ff6fc0622bfae5d13d3a3838fbec3d9d21092 (patch) | |
tree | 9650a936ff5061230485f1a3f4e4a6d90470250a /Lib/test/test_descr.py | |
parent | f3c4ad14104ad45bd53df7b7e63cfc889efc3c05 (diff) | |
download | cpython-533ff6fc0622bfae5d13d3a3838fbec3d9d21092.zip cpython-533ff6fc0622bfae5d13d3a3838fbec3d9d21092.tar.gz cpython-533ff6fc0622bfae5d13d3a3838fbec3d9d21092.tar.bz2 |
Patch #1434038: property() now uses the getter's docstring if there is
no "doc" argument given. This makes it possible to legitimately use
property() as a decorator to produce a read-only property.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 68a11fa..57a8f44 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -2008,6 +2008,18 @@ def properties(): else: raise TestFailed, "expected ZeroDivisionError from bad property" + class E(object): + def getter(self): + "getter method" + return 0 + def setter(self, value): + "setter method" + pass + prop = property(getter) + vereq(prop.__doc__, "getter method") + prop2 = property(fset=setter) + vereq(prop2.__doc__, None) + def supers(): if verbose: print "Testing super..." |