~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_generate_ids.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-10 01:05:01 UTC
  • mfrom: (2872.5.5 129701-readonly-commit)
  • Revision ID: pqm@pqm.ubuntu.com-20071010010501-ejbj03m5w3k9vdsd
Avoid internal error tracebacks on failure to lock on readonly transport (#129701)

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
class TestGenRevisionId(tests.TestCase):
113
113
    """Test generating revision ids"""
114
114
 
115
 
    def assertMatchesRe(self, regex, text):
116
 
        """Make sure text is matched by the regex given"""
117
 
        if re.match(regex, text) is None:
118
 
            self.fail('Pattern %s did not match text %s' % (regex, text))
119
 
 
120
115
    def assertGenRevisionId(self, regex, username, timestamp=None):
121
116
        """gen_revision_id should create a revision id matching the regex"""
122
117
        revision_id = generate_ids.gen_revision_id(username, timestamp)
123
 
        self.assertMatchesRe(regex, revision_id)
 
118
        self.assertContainsRe(revision_id, '^'+regex+'$')
124
119
        # It should be a utf8 revision_id, not a unicode one
125
120
        self.assertIsInstance(revision_id, str)
126
121
        # gen_revision_id should always return ascii revision ids.