summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-08-17 13:40:47 (GMT)
committerGuido van Rossum <guido@python.org>2001-08-17 13:40:47 (GMT)
commit93018760bc597f65e8a94c30546eafafd095f170 (patch)
tree93feb4ab6b0e6eb1e325ef3bfafb7f5a5f30fb3d /Lib
parentcdf0d75897ddde0b27bad24aac4845824578f5ee (diff)
downloadcpython-93018760bc597f65e8a94c30546eafafd095f170.zip
cpython-93018760bc597f65e8a94c30546eafafd095f170.tar.gz
cpython-93018760bc597f65e8a94c30546eafafd095f170.tar.bz2
classic(), methods(): add another test relating to unbound methods:
when an unbound method of class A is stored as a class variable of class B, and class B is *not* a subclass of class A, that method should *not* get bound to B instances.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_descr.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index a26a1e2..e40e003 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -760,6 +760,9 @@ def classic():
verify(d.goo(1) == (D, 1))
verify(d.foo(1) == (d, 1))
verify(D.foo(d, 1) == (d, 1))
+ class E: # *not* subclassing from C
+ foo = C.foo
+ verify(E().foo == C.foo) # i.e., unbound
def compattr():
if verbose: print "Testing computed attributes..."
@@ -901,6 +904,9 @@ def methods():
verify(d2.foo() == 2)
verify(d2.boo() == 2)
verify(d2.goo() == 1)
+ class E(object):
+ foo = C.foo
+ verify(E().foo == C.foo) # i.e., unbound
def specials():
# Test operators like __hash__ for which a built-in default exists