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

Guido van Rossum gvanrossum@users.sourceforge.net
Sun, 08 Jul 2001 18:26:21 -0700


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

Modified Files:
      Tag: descr-branch
	test_descr.py 
Log Message:
After the merge, this test was failing on a test that insisted that

  class C(object):
      __slots__ = {}

be an error.

Well, because of the way it was written (slots was converted to a
tuple using PySequence_Tuple()) and because of enhanced behavior of
dictionaries (a dictionary in a sequence context behaves like a list
of its keys) this is no longer an error.

Rather than trying to make this an error, I propose to accept this
defeat, and use a different non-sequence type in the test.

If the __slots__ variable is a dictionary, the values are ignored.
But they might be used by some future tool, e.g. as doc strings, or
type specs, or whatever.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v
retrieving revision 1.1.2.31
retrieving revision 1.1.2.32
diff -C2 -r1.1.2.31 -r1.1.2.32
*** test_descr.py	2001/07/08 01:38:59	1.1.2.31
--- test_descr.py	2001/07/09 01:26:19	1.1.2.32
***************
*** 606,614 ****
      try:
          class C(object):
!             __slots__ = {}
      except TypeError:
          pass
      else:
!         verify(0, "__slots__ = {} should be illegal")
  
      try:
--- 606,614 ----
      try:
          class C(object):
!             __slots__ = 1
      except TypeError:
          pass
      else:
!         verify(0, "__slots__ = 1 should be illegal")
  
      try: