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

Tim Peters tim_one@users.sourceforge.net
Wed, 12 Sep 2001 12:12:51 -0700


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

Modified Files:
	test_descr.py 
Log Message:
Again perhaps the end of [#460020] bug or feature: unicode() and subclasses.
Inhibited complex unary plus optimization when applied to a complex subtype.
Added PyComplex_CheckExact macro.  Some comments and minor code fiddling.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** test_descr.py	2001/09/12 07:54:51	1.48
--- test_descr.py	2001/09/12 19:12:48	1.49
***************
*** 1431,1434 ****
--- 1431,1458 ----
      verify((+a).__class__ is float)
  
+     class madcomplex(complex):
+         def __repr__(self):
+             return "%.17gj%+.17g" % (self.imag, self.real)
+     a = madcomplex(-3, 4)
+     verify(repr(a) == "4j-3")
+     base = complex(-3, 4)
+     verify(base.__class__ is complex)
+     verify(complex(a) == base)
+     verify(complex(a).__class__ is complex)
+     a = madcomplex(a)  # just trying another form of the constructor
+     verify(repr(a) == "4j-3")
+     verify(complex(a) == base)
+     verify(complex(a).__class__ is complex)
+     verify(hash(a) == hash(base))
+     verify((+a).__class__ is complex)
+     verify((a + 0).__class__ is complex)
+     verify(a + 0 == base)
+     verify((a - 0).__class__ is complex)
+     verify(a - 0 == base)
+     verify((a * 1).__class__ is complex)
+     verify(a * 1 == base)
+     verify((a / 1).__class__ is complex)
+     verify(a / 1 == base)
+ 
      class madtuple(tuple):
          _rev = None