Rev 4684: Fix assertEqualDiff messages in http://bazaar.launchpad.net/~vila/bzr/integration
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Sep 10 08:40:05 BST 2009
At http://bazaar.launchpad.net/~vila/bzr/integration
------------------------------------------------------------
revno: 4684 [merge]
revision-id: v.ladeuil+lp at free.fr-20090910073958-zl08i6kbq1tooltp
parent: pqm at pqm.ubuntu.com-20090910042032-r24kxnlc0ub231kj
parent: v.ladeuil+lp at free.fr-20090909172156-rzqanr0r7da50r4t
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: integration
timestamp: Thu 2009-09-10 09:39:58 +0200
message:
Fix assertEqualDiff messages
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2009-08-28 21:05:31 +0000
+++ b/bzrlib/tests/__init__.py 2009-09-09 17:21:56 +0000
@@ -982,9 +982,9 @@
return
if message is None:
message = "texts not equal:\n"
+ if a + '\n' == b:
+ message = 'first string is missing a final newline.\n'
if a == b + '\n':
- message = 'first string is missing a final newline.\n'
- if a + '\n' == b:
message = 'second string is missing a final newline.\n'
raise AssertionError(message +
self._ndiff_strings(a, b))
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2009-09-03 08:10:23 +0000
+++ b/bzrlib/tests/test_selftest.py 2009-09-09 15:27:48 +0000
@@ -1723,6 +1723,21 @@
self.assertEndsWith('foo', 'oo')
self.assertRaises(AssertionError, self.assertEndsWith, 'o', 'oo')
+ def test_assertEqualDiff(self):
+ e = self.assertRaises(AssertionError,
+ self.assertEqualDiff, '', '\n')
+ self.assertEquals(str(e),
+ # Don't blink ! The '+' applies to the second string
+ 'first string is missing a final newline.\n+ \n')
+ e = self.assertRaises(AssertionError,
+ self.assertEqualDiff, '\n', '')
+ self.assertEquals(str(e),
+ # Don't blink ! The '-' applies to the second string
+ 'second string is missing a final newline.\n- \n')
+
+
+class TestDeprecations(tests.TestCase):
+
def test_applyDeprecated_not_deprecated(self):
sample_object = ApplyDeprecatedHelper()
# calling an undeprecated callable raises an assertion
More information about the bazaar-commits
mailing list