[Python-checkins] python/dist/src/Lib/test test_descr.py,1.183,1.184

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 13 Feb 2003 08:25:09 -0800


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

Modified Files:
	test_descr.py 
Log Message:
SF patch #685738 by Michael Stone.

This changes the default __new__ to refuse arguments iff tp_init is the
default __init__ implementation -- thus making it a TypeError when you
try to pass arguments to a constructor if the class doesn't override at
least __init__ or __new__.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.183
retrieving revision 1.184
diff -C2 -d -r1.183 -r1.184
*** test_descr.py	12 Feb 2003 03:58:38 -0000	1.183
--- test_descr.py	13 Feb 2003 16:25:05 -0000	1.184
***************
*** 3695,3700 ****
              return "C.__rdiv__"
  
!     vereq(C(1) / 1, "C.__div__")
!     vereq(1 / C(1), "C.__rdiv__")
  
      # Case 3: subclass of new-style class; here it gets interesting
--- 3695,3700 ----
              return "C.__rdiv__"
  
!     vereq(C() / 1, "C.__div__")
!     vereq(1 / C(), "C.__rdiv__")
  
      # Case 3: subclass of new-style class; here it gets interesting
***************
*** 3706,3711 ****
              return "D.__rdiv__"
  
!     vereq(D(1) / C(1), "D.__div__")
!     vereq(C(1) / D(1), "D.__rdiv__")
  
      # Case 4: this didn't work right in 2.2.2 and 2.3a1
--- 3706,3711 ----
              return "D.__rdiv__"
  
!     vereq(D() / C(), "D.__div__")
!     vereq(C() / D(), "D.__rdiv__")
  
      # Case 4: this didn't work right in 2.2.2 and 2.3a1
***************
*** 3716,3723 ****
      vereq(E.__rdiv__, C.__rdiv__)
  
!     vereq(E(1) / 1, "C.__div__")
!     vereq(1 / E(1), "C.__rdiv__")
!     vereq(E(1) / C(1), "C.__div__")
!     vereq(C(1) / E(1), "C.__div__") # This one would fail
  
  def dict_type_with_metaclass():
--- 3716,3723 ----
      vereq(E.__rdiv__, C.__rdiv__)
  
!     vereq(E() / 1, "C.__div__")
!     vereq(1 / E(), "C.__rdiv__")
!     vereq(E() / C(), "C.__div__")
!     vereq(C() / E(), "C.__div__") # This one would fail
  
  def dict_type_with_metaclass():