← Back to team overview

testtools-dev team mailing list archive

[Merge] lp:~jml/testtools/align-equals-879339 into lp:testtools

 

Jonathan Lange has proposed merging lp:~jml/testtools/align-equals-879339 into lp:testtools.

Requested reviews:
  testtools committers (testtools-committers)
Related bugs:
  Bug #879339 in testtools: "Align 'assertEqual' output"
  https://bugs.launchpad.net/testtools/+bug/879339

For more details, see:
https://code.launchpad.net/~jml/testtools/align-equals-879339/+merge/80758

Straightforward branch that aligns the equality error message as requested in bug 879339.
-- 
https://code.launchpad.net/~jml/testtools/align-equals-879339/+merge/80758
Your team testtools developers is subscribed to branch lp:testtools.
=== modified file 'testtools/matchers.py'
--- testtools/matchers.py	2011-09-14 10:12:20 +0000
+++ testtools/matchers.py	2011-10-30 16:30:28 +0000
@@ -378,7 +378,7 @@
         left = repr(self.expected)
         right = repr(self.other)
         if len(left) + len(right) > 70:
-            return "%s:\nreference = %s\nactual = %s\n" % (
+            return "%s:\nreference = %s\nactual    = %s\n" % (
                 self._mismatch_string, self._format(self.expected),
                 self._format(self.other))
         else:

=== modified file 'testtools/tests/test_matchers.py'
--- testtools/tests/test_matchers.py	2011-09-14 10:12:20 +0000
+++ testtools/tests/test_matchers.py	2011-10-30 16:30:28 +0000
@@ -155,7 +155,7 @@
         one_line_b = self._long_b.replace(_b("\n"), _b(" "))
         mismatch = _BinaryMismatch(one_line_b, "!~", self._long_b)
         self.assertEqual(mismatch.describe(),
-            "%s:\nreference = %s\nactual = %s\n" % ("!~",
+            "%s:\nreference = %s\nactual    = %s\n" % ("!~",
                 text_repr(one_line_b),
                 text_repr(self._long_b, multiline=True)))
 
@@ -163,14 +163,14 @@
         one_line_u = self._long_u.replace("\n", " ")
         mismatch = _BinaryMismatch(one_line_u, "!~", self._long_u)
         self.assertEqual(mismatch.describe(),
-            "%s:\nreference = %s\nactual = %s\n" % ("!~",
+            "%s:\nreference = %s\nactual    = %s\n" % ("!~",
                 text_repr(one_line_u),
                 text_repr(self._long_u, multiline=True)))
 
     def test_long_mixed_strings(self):
         mismatch = _BinaryMismatch(self._long_b, "!~", self._long_u)
         self.assertEqual(mismatch.describe(),
-            "%s:\nreference = %s\nactual = %s\n" % ("!~",
+            "%s:\nreference = %s\nactual    = %s\n" % ("!~",
                 text_repr(self._long_b, multiline=True),
                 text_repr(self._long_u, multiline=True)))
 
@@ -178,7 +178,7 @@
         obj = object()
         mismatch = _BinaryMismatch(self._long_b, "!~", obj)
         self.assertEqual(mismatch.describe(),
-            "%s:\nreference = %s\nactual = %s\n" % ("!~",
+            "%s:\nreference = %s\nactual    = %s\n" % ("!~",
                 text_repr(self._long_b, multiline=True),
                 repr(obj)))
 
@@ -186,7 +186,7 @@
         obj = object()
         mismatch = _BinaryMismatch(self._long_u, "!~", obj)
         self.assertEqual(mismatch.describe(),
-            "%s:\nreference = %s\nactual = %s\n" % ("!~",
+            "%s:\nreference = %s\nactual    = %s\n" % ("!~",
                 text_repr(self._long_u, multiline=True),
                 repr(obj)))
 

=== modified file 'testtools/tests/test_testcase.py'
--- testtools/tests/test_testcase.py	2011-09-14 10:12:20 +0000
+++ testtools/tests/test_testcase.py	2011-10-30 16:30:28 +0000
@@ -550,7 +550,7 @@
         expected_error = '\n'.join([
             '!=:',
             'reference = %s' % pformat(a),
-            'actual = %s' % pformat(b),
+            'actual    = %s' % pformat(b),
             ': ' + message,
             ])
         self.assertFails(expected_error, self.assertEqual, a, b, message)
@@ -575,7 +575,7 @@
             'a',
             repr('\xa7')[1:-1],
             "'''",
-            'actual = %r' % (b,),
+            'actual    = %r' % (b,),
             ': ' + message,
             ])
         self.assertFails(expected_error, self.assertEqual, a, b, message)


Follow ups