~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-07-04 09:53:20 UTC
  • mfrom: (2555.3.22 dlock)
  • Revision ID: pqm@pqm.ubuntu.com-20070704095320-41p0gvstimqqzvtx
(mbp,r=john,r=robertc) -Dlock and lockdir fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
828
828
            return
829
829
        if message is None:
830
830
            message = "texts not equal:\n"
831
 
        raise AssertionError(message + 
832
 
                             self._ndiff_strings(a, b))      
 
831
        raise AssertionError(message +
 
832
                             self._ndiff_strings(a, b))
833
833
        
834
834
    def assertEqualMode(self, mode, mode_test):
835
835
        self.assertEqual(mode, mode_test,
847
847
    def assertContainsRe(self, haystack, needle_re):
848
848
        """Assert that a contains something matching a regular expression."""
849
849
        if not re.search(needle_re, haystack):
850
 
            raise AssertionError('pattern "%r" not found in "%r"'
851
 
                    % (needle_re, haystack))
 
850
            if '\n' in haystack or len(haystack) > 60:
 
851
                # a long string, format it in a more readable way
 
852
                raise AssertionError(
 
853
                        'pattern "%s" not found in\n"""\\\n%s"""\n'
 
854
                        % (needle_re, haystack))
 
855
            else:
 
856
                raise AssertionError('pattern "%s" not found in "%s"'
 
857
                        % (needle_re, haystack))
852
858
 
853
859
    def assertNotContainsRe(self, haystack, needle_re):
854
860
        """Assert that a does not match a regular expression"""