Rev 4684: (vila) Fix assertEqualDiff messages in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 10 09:43:53 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4684 [merge]
revision-id: pqm at pqm.ubuntu.com-20090910084352-dnlxfwi1ovyjfe0e
parent: pqm at pqm.ubuntu.com-20090910042032-r24kxnlc0ub231kj
parent: v.ladeuil+lp at free.fr-20090910073958-zl08i6kbq1tooltp
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-09-10 09:43:52 +0100
message:
  (vila) Fix assertEqualDiff messages
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
=== 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