def testNotmuch(self): revision = 'f717d2ece1836c863f9cc02abd1ff2539307cd1d' matcher = RevlinkMatch(['git://notmuchmail.org/git/(.*)'], r'http://git.notmuchmail.org/git/\1/commit/%s') self.assertEqual( matcher(revision, 'git://notmuchmail.org/git/notmuch'), 'http://git.notmuchmail.org/git/notmuch/commit/f717d2ece1836c863f9cc02abd1ff2539307cd1d' )
def testSingleUnicode(self): revision = 'rev' matcher = RevlinkMatch(u'test', 'out%s') self.assertEqual(matcher(revision, 'test'), 'outrev')
def testTwoCaptureGroups(self): revision = 'rev' matcher = RevlinkMatch('([A-Z]*)Z([0-9]*)', r'\2-\1-%s') self.assertEqual(matcher(revision, 'ABCZ43'), '43-ABC-rev')
def testSingleString(self): revision = 'rev' matcher = RevlinkMatch('test', 'out%s') self.assertEquals(matcher(revision, 'test'), 'outrev')