[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.26,1.1.2.27

Guido van Rossum gvanrossum@users.sourceforge.net
Tue, 03 Jul 2001 17:44:02 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv32565

Modified Files:
      Tag: descr-branch
	test_descr.py 
Log Message:
Add test for static methods (similar to test for class methods).

Move a few lines around for consistency.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v
retrieving revision 1.1.2.26
retrieving revision 1.1.2.27
diff -C2 -r1.1.2.26 -r1.1.2.27
*** test_descr.py	2001/07/04 00:40:57	1.1.2.26
--- test_descr.py	2001/07/04 00:44:00	1.1.2.27
***************
*** 621,626 ****
          def foo(*a): return a
          goo = classmethod(foo)
-     verify(C.goo(1) == (C, 1))
      c = C()
      verify(c.goo(1) == (C, 1))
      verify(c.foo(1) == (c, 1))
--- 621,626 ----
          def foo(*a): return a
          goo = classmethod(foo)
      c = C()
+     verify(C.goo(1) == (C, 1))
      verify(c.goo(1) == (C, 1))
      verify(c.foo(1) == (c, 1))
***************
*** 633,636 ****
--- 633,653 ----
      verify(D.foo(d, 1) == (d, 1))
  
+ def staticmethods():
+     if verbose: print "Testing static methods..."
+     class C(object):
+         def foo(*a): return a
+         goo = staticmethod(foo)
+     c = C()
+     verify(C.goo(1) == (1,))
+     verify(c.goo(1) == (1,))
+     verify(c.foo(1) == (c, 1,))
+     class D(C):
+         pass
+     d = D()
+     verify(D.goo(1) == (1,))
+     verify(d.goo(1) == (1,))
+     verify(d.foo(1) == (d, 1))
+     verify(D.foo(d, 1) == (d, 1))
+ 
  def classic():
      if verbose: print "Testing classic classes..."
***************
*** 638,643 ****
          def foo(*a): return a
          goo = classmethod(foo)
-     verify(C.goo(1) == (C, 1))
      c = C()
      verify(c.goo(1) == (C, 1))
      verify(c.foo(1) == (c, 1))
--- 655,660 ----
          def foo(*a): return a
          goo = classmethod(foo)
      c = C()
+     verify(C.goo(1) == (C, 1))
      verify(c.goo(1) == (C, 1))
      verify(c.foo(1) == (c, 1))
***************
*** 715,718 ****
--- 732,736 ----
      errors()
      classmethods()
+     staticmethods()
      classic()
      compattr()