[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.123,1.124
Fred L. Drake
fdrake@users.sourceforge.net
Thu, 28 Mar 2002 07:49:56 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv30051/Lib/test
Modified Files:
test_descr.py
Log Message:
Add a simple test of the METH_CLASS and METH_STATIC flags for type methods.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.123
retrieving revision 1.124
diff -C2 -d -r1.123 -r1.124
*** test_descr.py 25 Mar 2002 18:36:32 -0000 1.123
--- test_descr.py 28 Mar 2002 15:49:54 -0000 1.124
***************
*** 1215,1218 ****
--- 1215,1232 ----
vereq(ff.__get__(0)(42), (int, 42))
+ def classmethods_in_c():
+ if verbose: print "Testing C-based class methods..."
+ import xxsubtype as spam
+ a = (1, 2, 3)
+ d = {'abc': 123}
+ x, a1, d1 = spam.spamlist.classmeth(*a, **d)
+ veris(x, None)
+ vereq((spam.spamlist,) + a, a1)
+ vereq(d, d1)
+ x, a1, d1 = spam.spamlist().classmeth(*a, **d)
+ veris(x, None)
+ vereq((spam.spamlist,) + a, a1)
+ vereq(d, d1)
+
def staticmethods():
if verbose: print "Testing static methods..."
***************
*** 1232,1235 ****
--- 1246,1263 ----
vereq(D.foo(d, 1), (d, 1))
+ def staticmethods_in_c():
+ if verbose: print "Testing C-based static methods..."
+ import xxsubtype as spam
+ a = (1, 2, 3)
+ d = {"abc": 123}
+ x, a1, d1 = spam.spamlist.staticmeth(*a, **d)
+ veris(x, None)
+ vereq(a, a1)
+ vereq(d, d1)
+ x, a1, d2 = spam.spamlist().staticmeth(*a, **d)
+ veris(x, None)
+ vereq(a, a1)
+ vereq(d, d1)
+
def classic():
if verbose: print "Testing classic classes..."
***************
*** 2885,2889 ****
--- 2913,2919 ----
errors()
classmethods()
+ classmethods_in_c()
staticmethods()
+ staticmethods_in_c()
classic()
compattr()