You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2013/02/06 23:54:16 UTC

svn commit: r1443263 - /subversion/trunk/subversion/tests/cmdline/svntest/verify.py

Author: julianfoad
Date: Wed Feb  6 22:54:15 2013
New Revision: 1443263

URL: http://svn.apache.org/viewvc?rev=1443263&view=rev
Log:
Remove an unused special case from the ExpectedOutput classes in the test
suite.

* subversion/tests/cmdline/svntest/verify.py
  (ExpectedOutput): Assert that 'expected' is not None, and remove the tiny
    bit of support for that case. Update a comment after r1443242.
  (AnyOutput): Initialize the expected output to [] instead of None.
  (compare_and_display_lines): Assert that 'expected' is not None. Document
    the 'actual' parameter.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/verify.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/verify.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/verify.py?rev=1443263&r1=1443262&r2=1443263&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/verify.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/verify.py Wed Feb  6 22:54:15 2013
@@ -101,11 +101,12 @@ class ExpectedOutput(object):
 
   def __init__(self, expected, match_all=True):
     """Initialize the expected output to EXPECTED which is a string, or
-    a list of strings, or None meaning an empty list. If MATCH_ALL is True, the
+    a list of strings. If MATCH_ALL is True, the
     expected strings will be matched with the actual strings, one-to-one, in
     the same order. If False, they will be matched with a subset of the
     actual strings, one-to-one, in the same order, ignoring any other actual
     strings among the matching ones."""
+    assert expected is not None
     self.expected = expected
     self.match_all = match_all
 
@@ -117,13 +118,11 @@ class ExpectedOutput(object):
                     "see the 'matches()' method")
 
   def matches(self, actual, except_re=None):
-    """Return whether SELF.expected matches OTHER (which may be a list
-    of newline-terminated lines, or a single string).  Either value
-    may be None."""
+    """Return whether SELF.expected matches ACTUAL (which may be a list
+    of newline-terminated lines, or a single string).  ACTUAL may be None,
+    meaning an empty list."""
     expected = self.expected
-    if expected is None:
-      expected = []
-    elif not isinstance(expected, list):
+    if not isinstance(expected, list):
       expected = [expected]
     if actual is None:
       actual = []
@@ -180,7 +179,7 @@ class ExpectedOutput(object):
 class AnyOutput(ExpectedOutput):
   """Matches any non-empty output."""
   def __init__(self):
-    ExpectedOutput.__init__(self, None, False)
+    ExpectedOutput.__init__(self, [], False)
 
   def is_equivalent_list(self, ignored, actual):
     if len(actual) == 0:
@@ -353,13 +352,15 @@ def compare_and_display_lines(message, l
                               raisable=None, except_re=None):
   """Compare two sets of output lines, and print them if they differ,
   preceded by MESSAGE iff not None.  EXPECTED may be an instance of
-  ExpectedOutput (and if not, it is wrapped as such).  RAISABLE is an
+  ExpectedOutput (and if not, it is wrapped as such).  ACTUAL may be a
+  list of newline-terminated lines, or a single string.  RAISABLE is an
   exception class, an instance of which is thrown if ACTUAL doesn't
   match EXPECTED."""
   if raisable is None:
     raisable = svntest.main.SVNLineUnequal
   ### It'd be nicer to use createExpectedOutput() here, but its
   ### semantics don't match all current consumers of this function.
+  assert expected is not None
   if not isinstance(expected, ExpectedOutput):
     expected = ExpectedOutput(expected)