Merge lp:~jml/testtools/align-equals-879339 into lp:~testtools-committers/testtools/trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: 231
Proposed branch: lp:~jml/testtools/align-equals-879339
Merge into: lp:~testtools-committers/testtools/trunk
Diff against target: 82 lines (+8/-8)
3 files modified
testtools/matchers.py (+1/-1)
testtools/tests/test_matchers.py (+5/-5)
testtools/tests/test_testcase.py (+2/-2)
To merge this branch: bzr merge lp:~jml/testtools/align-equals-879339
Reviewer Review Type Date Requested Status
testtools committers Pending
Review via email: mp+80758@code.launchpad.net

Description of the change

Straightforward branch that aligns the equality error message as requested in bug 879339.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

+1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testtools/matchers.py'
2--- testtools/matchers.py 2011-09-14 10:12:20 +0000
3+++ testtools/matchers.py 2011-10-30 16:30:28 +0000
4@@ -378,7 +378,7 @@
5 left = repr(self.expected)
6 right = repr(self.other)
7 if len(left) + len(right) > 70:
8- return "%s:\nreference = %s\nactual = %s\n" % (
9+ return "%s:\nreference = %s\nactual = %s\n" % (
10 self._mismatch_string, self._format(self.expected),
11 self._format(self.other))
12 else:
13
14=== modified file 'testtools/tests/test_matchers.py'
15--- testtools/tests/test_matchers.py 2011-09-14 10:12:20 +0000
16+++ testtools/tests/test_matchers.py 2011-10-30 16:30:28 +0000
17@@ -155,7 +155,7 @@
18 one_line_b = self._long_b.replace(_b("\n"), _b(" "))
19 mismatch = _BinaryMismatch(one_line_b, "!~", self._long_b)
20 self.assertEqual(mismatch.describe(),
21- "%s:\nreference = %s\nactual = %s\n" % ("!~",
22+ "%s:\nreference = %s\nactual = %s\n" % ("!~",
23 text_repr(one_line_b),
24 text_repr(self._long_b, multiline=True)))
25
26@@ -163,14 +163,14 @@
27 one_line_u = self._long_u.replace("\n", " ")
28 mismatch = _BinaryMismatch(one_line_u, "!~", self._long_u)
29 self.assertEqual(mismatch.describe(),
30- "%s:\nreference = %s\nactual = %s\n" % ("!~",
31+ "%s:\nreference = %s\nactual = %s\n" % ("!~",
32 text_repr(one_line_u),
33 text_repr(self._long_u, multiline=True)))
34
35 def test_long_mixed_strings(self):
36 mismatch = _BinaryMismatch(self._long_b, "!~", self._long_u)
37 self.assertEqual(mismatch.describe(),
38- "%s:\nreference = %s\nactual = %s\n" % ("!~",
39+ "%s:\nreference = %s\nactual = %s\n" % ("!~",
40 text_repr(self._long_b, multiline=True),
41 text_repr(self._long_u, multiline=True)))
42
43@@ -178,7 +178,7 @@
44 obj = object()
45 mismatch = _BinaryMismatch(self._long_b, "!~", obj)
46 self.assertEqual(mismatch.describe(),
47- "%s:\nreference = %s\nactual = %s\n" % ("!~",
48+ "%s:\nreference = %s\nactual = %s\n" % ("!~",
49 text_repr(self._long_b, multiline=True),
50 repr(obj)))
51
52@@ -186,7 +186,7 @@
53 obj = object()
54 mismatch = _BinaryMismatch(self._long_u, "!~", obj)
55 self.assertEqual(mismatch.describe(),
56- "%s:\nreference = %s\nactual = %s\n" % ("!~",
57+ "%s:\nreference = %s\nactual = %s\n" % ("!~",
58 text_repr(self._long_u, multiline=True),
59 repr(obj)))
60
61
62=== modified file 'testtools/tests/test_testcase.py'
63--- testtools/tests/test_testcase.py 2011-09-14 10:12:20 +0000
64+++ testtools/tests/test_testcase.py 2011-10-30 16:30:28 +0000
65@@ -550,7 +550,7 @@
66 expected_error = '\n'.join([
67 '!=:',
68 'reference = %s' % pformat(a),
69- 'actual = %s' % pformat(b),
70+ 'actual = %s' % pformat(b),
71 ': ' + message,
72 ])
73 self.assertFails(expected_error, self.assertEqual, a, b, message)
74@@ -575,7 +575,7 @@
75 'a',
76 repr('\xa7')[1:-1],
77 "'''",
78- 'actual = %r' % (b,),
79+ 'actual = %r' % (b,),
80 ': ' + message,
81 ])
82 self.assertFails(expected_error, self.assertEqual, a, b, message)

Subscribers

People subscribed via source and target branches