[Python-checkins] CVS: python/dist/src/Lib/test test_re.py,1.24,1.25

Fred L. Drake python-dev@python.org
Fri, 18 Aug 2000 09:09:59 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory slayer.i.sourceforge.net:/tmp/cvs-serv13013/Lib/test

Modified Files:
	test_re.py 
Log Message:

Better conformance to the Python Style Guide: use spaces around operators.


Index: test_re.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** test_re.py	2000/08/08 17:06:52	1.24
--- test_re.py	2000/08/18 16:09:56	1.25
***************
*** 1,4 ****
  import sys
! sys.path=['.']+sys.path
  
  from test_support import verbose, TestFailed
--- 1,4 ----
  import sys
! sys.path = ['.'] + sys.path
  
  from test_support import verbose, TestFailed
***************
*** 271,286 ****
  for t in tests:
      sys.stdout.flush()
!     pattern=s=outcome=repl=expected=None
!     if len(t)==5:
          pattern, s, outcome, repl, expected = t
!     elif len(t)==3:
          pattern, s, outcome = t
      else:
!         raise ValueError, ('Test tuples should have 3 or 5 fields',t)
  
      try:
!         obj=re.compile(pattern)
      except re.error:
!         if outcome==SYNTAX_ERROR: pass  # Expected a syntax error
          else:
              print '=== Syntax error:', t
--- 271,286 ----
  for t in tests:
      sys.stdout.flush()
!     pattern = s = outcome = repl = expected = None
!     if len(t) == 5:
          pattern, s, outcome, repl, expected = t
!     elif len(t) == 3:
          pattern, s, outcome = t
      else:
!         raise ValueError, ('Test tuples should have 3 or 5 fields', t)
  
      try:
!         obj = re.compile(pattern)
      except re.error:
!         if outcome == SYNTAX_ERROR: pass  # Expected a syntax error
          else:
              print '=== Syntax error:', t
***************
*** 292,305 ****
      else:
          try:
!             result=obj.search(s)
!         except (re.error), msg:
              print '=== Unexpected exception', t, repr(msg)
!         if outcome==SYNTAX_ERROR:
              # This should have been a syntax error; forget it.
              pass
!         elif outcome==FAIL:
              if result is None: pass   # No match, as expected
              else: print '=== Succeeded incorrectly', t
!         elif outcome==SUCCEED:
              if result is not None:
                  # Matched, as expected, so now we compute the
--- 292,305 ----
      else:
          try:
!             result = obj.search(s)
!         except re.error, msg:
              print '=== Unexpected exception', t, repr(msg)
!         if outcome == SYNTAX_ERROR:
              # This should have been a syntax error; forget it.
              pass
!         elif outcome == FAIL:
              if result is None: pass   # No match, as expected
              else: print '=== Succeeded incorrectly', t
!         elif outcome == SUCCEED:
              if result is not None:
                  # Matched, as expected, so now we compute the
***************
*** 326,333 ****
                          gi = "Error"
                      vardict[i] = gi
!                 repl=eval(repl, vardict)
!                 if repl!=expected:
                      print '=== grouping error', t,
!                     print repr(repl)+' should be '+repr(expected)
              else:
                  print '=== Failed incorrectly', t
--- 326,333 ----
                          gi = "Error"
                      vardict[i] = gi
!                 repl = eval(repl, vardict)
!                 if repl != expected:
                      print '=== grouping error', t,
!                     print repr(repl) + ' should be ' + repr(expected)
              else:
                  print '=== Failed incorrectly', t
***************
*** 335,340 ****
              # Try the match on a unicode string, and check that it
              # still succeeds.
!             result=obj.search(unicode(s, "latin-1"))
!             if result==None:
                  print '=== Fails on unicode match', t
  
--- 335,340 ----
              # Try the match on a unicode string, and check that it
              # still succeeds.
!             result = obj.search(unicode(s, "latin-1"))
!             if result == None:
                  print '=== Fails on unicode match', t
  
***************
*** 342,347 ****
              # still succeeds.
              obj=re.compile(unicode(pattern, "latin-1"))
!             result=obj.search(s)
!             if result==None:
                  print '=== Fails on unicode pattern match', t
  
--- 342,347 ----
              # still succeeds.
              obj=re.compile(unicode(pattern, "latin-1"))
!             result = obj.search(s)
!             if result == None:
                  print '=== Fails on unicode pattern match', t
  
***************
*** 351,378 ****
              # string), so we'll ignore patterns that feature it.
  
!             if pattern[:2]!='\\B' and pattern[-2:]!='\\B' and result!=None:
!                 obj=re.compile(pattern)
!                 result=obj.search(s, result.start(0), result.end(0)+1)
!                 if result==None:
                      print '=== Failed on range-limited match', t
  
              # Try the match with IGNORECASE enabled, and check that it
              # still succeeds.
!             obj=re.compile(pattern, re.IGNORECASE)
!             result=obj.search(s)
!             if result==None:
                  print '=== Fails on case-insensitive match', t
  
              # Try the match with LOCALE enabled, and check that it
              # still succeeds.
!             obj=re.compile(pattern, re.LOCALE)
!             result=obj.search(s)
!             if result==None:
                  print '=== Fails on locale-sensitive match', t
  
              # Try the match with UNICODE locale enabled, and check
              # that it still succeeds.
!             obj=re.compile(pattern, re.UNICODE)
!             result=obj.search(s)
!             if result==None:
                  print '=== Fails on unicode-sensitive match', t
--- 351,379 ----
              # string), so we'll ignore patterns that feature it.
  
!             if pattern[:2] != '\\B' and pattern[-2:] != '\\B' \
! 			   and result != None:
!                 obj = re.compile(pattern)
!                 result = obj.search(s, result.start(0), result.end(0) + 1)
!                 if result == None:
                      print '=== Failed on range-limited match', t
  
              # Try the match with IGNORECASE enabled, and check that it
              # still succeeds.
!             obj = re.compile(pattern, re.IGNORECASE)
!             result = obj.search(s)
!             if result == None:
                  print '=== Fails on case-insensitive match', t
  
              # Try the match with LOCALE enabled, and check that it
              # still succeeds.
!             obj = re.compile(pattern, re.LOCALE)
!             result = obj.search(s)
!             if result == None:
                  print '=== Fails on locale-sensitive match', t
  
              # Try the match with UNICODE locale enabled, and check
              # that it still succeeds.
!             obj = re.compile(pattern, re.UNICODE)
!             result = obj.search(s)
!             if result == None:
                  print '=== Fails on unicode-sensitive match', t