~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_generate_ids.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-12 05:26:46 UTC
  • mfrom: (2904 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2906.
  • Revision ID: andrew.bennetts@canonical.com-20071012052646-wl95idld3ijjy714
Merge from bzr.dev.

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.