diff options
author | Guido van Rossum <guido@python.org> | 2003-04-16 20:02:22 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-16 20:02:22 (GMT) |
commit | a4541a30fcd101c6c6ed83a55d13c505f97378d8 (patch) | |
tree | 491836909511d88cb7e4e60cb056ad2f741f7f4c | |
parent | 6cc5bb685db13616f3f6474b9556d9bfc5195b20 (diff) | |
download | cpython-a4541a30fcd101c6c6ed83a55d13c505f97378d8.zip cpython-a4541a30fcd101c6c6ed83a55d13c505f97378d8.tar.gz cpython-a4541a30fcd101c6c6ed83a55d13c505f97378d8.tar.bz2 |
- super() no longer ignores data descriptors, except __class__. See
the thread started at
http://mail.python.org/pipermail/python-dev/2003-April/034338.html
-rw-r--r-- | Lib/test/test_descr.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 4a9cc50..972e224 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1989,7 +1989,7 @@ def supers(): class F(E): def meth(self, a): - s = self.__super + s = self.__super # == mysuper(F, self) return "F(%r)[%s]" % (a, s.__class__.__name__) + s.meth(a) F._F__super = mysuper(F) @@ -2025,6 +2025,21 @@ def supers(): else: raise TestFailed, "shouldn't allow super(D).__get__(C())" + # Make sure data descriptors can be overridden and accessed via super + # (new feature in Python 2.3) + + class DDbase(object): + def getx(self): return 42 + x = property(getx) + + class DDsub(DDbase): + def getx(self): return "hello" + x = property(getx) + + dd = DDsub() + vereq(dd.x, "hello") + vereq(super(DDsub, dd).x, 42) + def inherits(): if verbose: print "Testing inheritance from basic types..." |