~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Ian Clatworthy
  • Date: 2009-01-15 22:51:27 UTC
  • mfrom: (3940.1.5 bzr.log-short-file-fix)
  • mto: This revision was merged to the branch mainline in revision 3943.
  • Revision ID: ian.clatworthy@canonical.com-20090115225127-hbl4j2cgoy7zu2oz
Fix log --short/--line FILE (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
909
909
        if not s.endswith(suffix):
910
910
            raise AssertionError('string %r does not end with %r' % (s, suffix))
911
911
 
912
 
    def assertContainsRe(self, haystack, needle_re):
 
912
    def assertContainsRe(self, haystack, needle_re, flags=0):
913
913
        """Assert that a contains something matching a regular expression."""
914
 
        if not re.search(needle_re, haystack):
 
914
        if not re.search(needle_re, haystack, flags):
915
915
            if '\n' in haystack or len(haystack) > 60:
916
916
                # a long string, format it in a more readable way
917
917
                raise AssertionError(
921
921
                raise AssertionError('pattern "%s" not found in "%s"'
922
922
                        % (needle_re, haystack))
923
923
 
924
 
    def assertNotContainsRe(self, haystack, needle_re):
 
924
    def assertNotContainsRe(self, haystack, needle_re, flags=0):
925
925
        """Assert that a does not match a regular expression"""
926
 
        if re.search(needle_re, haystack):
 
926
        if re.search(needle_re, haystack, flags):
927
927
            raise AssertionError('pattern "%s" found in "%s"'
928
928
                    % (needle_re, haystack))
929
929