[Python-checkins] python/dist/src/Lib/test regrtest.py,1.94,1.95

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Fri, 23 Aug 2002 10:55:56 -0700


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

Modified Files:
	regrtest.py 
Log Message:
Got rid of the toy _Set class, in favor of sets.Set.


Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.94
retrieving revision 1.95
diff -C2 -d -r1.94 -r1.95
*** regrtest.py	14 Aug 2002 17:54:48 -0000	1.94
--- regrtest.py	23 Aug 2002 17:55:54 -0000	1.95
***************
*** 65,68 ****
--- 65,69 ----
  import StringIO
  import warnings
+ from sets import Set
  
  # I see no other way to suppress these warnings;
***************
*** 263,267 ****
          plat = sys.platform
          if e.isvalid():
!             surprise = _Set(skipped) - e.getexpected()
              if surprise:
                  print count(len(surprise), "skip"), \
--- 264,268 ----
          plat = sys.platform
          if e.isvalid():
!             surprise = Set(skipped) - e.getexpected()
              if surprise:
                  print count(len(surprise), "skip"), \
***************
*** 469,473 ****
  
  def printlist(x, width=70, indent=4):
!     """Print the elements of a sequence to stdout.
  
      Optional arg width (default 70) is the maximum line length.
--- 470,474 ----
  
  def printlist(x, width=70, indent=4):
!     """Print the elements of iterable x to stdout.
  
      Optional arg width (default 70) is the maximum line length.
***************
*** 481,512 ****
                 initial_indent=blanks, subsequent_indent=blanks)
  
- class _Set:
-     def __init__(self, seq=[]):
-         data = self.data = {}
-         for x in seq:
-             data[x] = 1
- 
-     def __len__(self):
-         return len(self.data)
- 
-     def __sub__(self, other):
-         "Return set of all elements in self not in other."
-         result = _Set()
-         data = result.data = self.data.copy()
-         for x in other.data:
-             if x in data:
-                 del data[x]
-         return result
- 
-     def __iter__(self):
-         return iter(self.data)
- 
-     def tolist(self, sorted=1):
-         "Return _Set elements as a list."
-         data = self.data.keys()
-         if sorted:
-             data.sort()
-         return data
- 
  # Map sys.platform to a string containing the basenames of tests
  # expected to be skipped on that platform.
--- 482,485 ----
***************
*** 777,785 ****
  class _ExpectedSkips:
      def __init__(self):
!         self.valid = 0
          if sys.platform in _expectations:
              s = _expectations[sys.platform]
!             self.expected = _Set(s.split())
!             self.valid = 1
  
      def isvalid(self):
--- 750,758 ----
  class _ExpectedSkips:
      def __init__(self):
!         self.valid = False
          if sys.platform in _expectations:
              s = _expectations[sys.platform]
!             self.expected = Set(s.split())
!             self.valid = True
  
      def isvalid(self):