Mercurial > python-hglib
diff tests/test-grep.py @ 143:4359cabcb0cc
hglib: move string literals in the test code to util.b() (issue4520)
author | Brett Cannon <brett@python.org> |
---|---|
date | Mon, 09 Mar 2015 18:26:25 -0400 |
parents | 1b47146a4a2c |
children | c1b966866ed7 |
line wrap: on
line diff
--- a/tests/test-grep.py Sun Mar 08 13:08:37 2015 -0400 +++ b/tests/test-grep.py Mon Mar 09 18:26:25 2015 -0400 @@ -1,39 +1,45 @@ import common +from hglib.util import b class test_grep(common.basetest): def test_basic(self): self.append('a', 'a\n') self.append('b', 'ab\n') - self.client.commit('first', addremove=True) + self.client.commit(b('first'), addremove=True) # no match - self.assertEquals(list(self.client.grep('c')), []) + self.assertEquals(list(self.client.grep(b('c'))), []) - self.assertEquals(list(self.client.grep('a')), - [('a', '0', 'a'), ('b', '0', 'ab')]) - self.assertEquals(list(self.client.grep('a', 'a')), [('a', '0', 'a')]) + self.assertEquals(list(self.client.grep(b('a'))), + [(b('a'), b('0'), b('a')), (b('b'), b('0'), b('ab'))]) + self.assertEquals(list(self.client.grep(b('a'), b('a'))), + [(b('a'), b('0'), b('a'))]) - self.assertEquals(list(self.client.grep('b')), [('b', '0', 'ab')]) + self.assertEquals(list(self.client.grep(b('b'))), + [(b('b'), b('0'), b('ab'))]) def test_options(self): self.append('a', 'a\n') self.append('b', 'ab\n') - rev, node = self.client.commit('first', addremove=True) + rev, node = self.client.commit(b('first'), addremove=True) - self.assertEquals([('a', '0', '+', 'a'), ('b', '0', '+', 'ab')], - list(self.client.grep('a', all=True))) + self.assertEquals([(b('a'), b('0'), b('+'), b('a')), + (b('b'), b('0'), b('+'), b('ab'))], + list(self.client.grep(b('a'), all=True))) - self.assertEquals([('a', '0'), ('b', '0')], - list(self.client.grep('a', fileswithmatches=True))) + self.assertEquals([(b('a'), b('0')), (b('b'), b('0'))], + list(self.client.grep(b('a'), fileswithmatches=True))) - self.assertEquals([('a', '0', '1', 'a'), ('b', '0', '1', 'ab')], - list(self.client.grep('a', line=True))) + self.assertEquals([(b('a'), b('0'), b('1'), b('a')), + (b('b'), b('0'), b('1'), b('ab'))], + list(self.client.grep(b('a'), line=True))) - self.assertEquals([('a', '0', 'test', 'a'), ('b', '0', 'test', 'ab')], - list(self.client.grep('a', user=True))) + self.assertEquals([(b('a'), b('0'), b('test'), b('a')), + (b('b'), b('0'), b('test'), b('ab'))], + list(self.client.grep(b('a'), user=True))) - self.assertEquals([('a', '0', '1', '+', 'test'), - ('b', '0', '1', '+', 'test')], - list(self.client.grep('a', all=True, user=True, + self.assertEquals([(b('a'), b('0'), b('1'), b('+'), b('test')), + (b('b'), b('0'), b('1'), b('+'), b('test'))], + list(self.client.grep(b('a'), all=True, user=True, line=True, fileswithmatches=True)))