[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.9,1.10
Guido van Rossum
gvanrossum@users.sourceforge.net
Wed, 15 Aug 2001 10:51:19 -0700
- Previous message: [Python-checkins] CVS: python/dist/src/Modules _localemodule.c,2.21,2.22 addrinfo.h,1.2,1.3 getnameinfo.c,1.3,1.4 socketmodule.c,1.164,1.165
- Next message: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.135,2.136
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv1522
Modified Files:
test_descr.py
Log Message:
Add a test to verify that bound methods work correctly.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_descr.py 2001/08/14 20:00:33 1.9
--- test_descr.py 2001/08/15 17:51:17 1.10
***************
*** 848,851 ****
--- 848,868 ----
verify(a.delslice == (0, 10))
+ def methods():
+ if verbose: print "testing methods..."
+ class C(object):
+ def __init__(self, x):
+ self.x = x
+ def foo(self):
+ return self.x
+ c1 = C(1)
+ verify(c1.foo() == 1)
+ class D(C):
+ boo = C.foo
+ goo = c1.foo
+ d2 = D(2)
+ verify(d2.foo() == 2)
+ verify(d2.boo() == 2)
+ verify(d2.goo() == 2)
+
def all():
lists()
***************
*** 874,877 ****
--- 891,895 ----
altmro()
overloading()
+ methods()
all()
- Previous message: [Python-checkins] CVS: python/dist/src/Modules _localemodule.c,2.21,2.22 addrinfo.h,1.2,1.3 getnameinfo.c,1.3,1.4 socketmodule.c,1.164,1.165
- Next message: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.135,2.136
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]