Mercurial > python-hglib
diff tests/test-update.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 | 9c4f52467208 |
children | c1b966866ed7 |
line wrap: on
line diff
--- a/tests/test-update.py Sun Mar 08 13:08:37 2015 -0400 +++ b/tests/test-update.py Mon Mar 09 18:26:25 2015 -0400 @@ -1,13 +1,14 @@ import common from hglib import error +from hglib.util import b class test_update(common.basetest): def setUp(self): common.basetest.setUp(self) self.append('a', 'a') - self.rev0, self.node0 = self.client.commit('first', addremove=True) + self.rev0, self.node0 = self.client.commit(b('first'), addremove=True) self.append('a', 'a') - self.rev1, self.node1 = self.client.commit('second') + self.rev1, self.node1 = self.client.commit(b('second')) def test_basic(self): u, m, r, ur = self.client.update(self.rev0) @@ -24,24 +25,24 @@ self.assertEquals(m, 0) self.assertEquals(r, 0) self.assertEquals(ur, 1) - self.assertTrue(('M', 'a') in self.client.status()) + self.assertTrue((b('M'), b('a')) in self.client.status()) def test_merge(self): self.append('a', '\n\n\n\nb') - rev2, node2 = self.client.commit('third') + rev2, node2 = self.client.commit(b('third')) self.append('a', 'b') - self.client.commit('fourth') + self.client.commit(b('fourth')) self.client.update(rev2) old = open('a').read() f = open('a', 'wb') - f.write('a' + old) + f.write(b('a') + old.encode('latin-1')) f.close() u, m, r, ur = self.client.update() self.assertEquals(u, 0) self.assertEquals(m, 1) self.assertEquals(r, 0) self.assertEquals(ur, 0) - self.assertEquals(self.client.status(), [('M', 'a')]) + self.assertEquals(self.client.status(), [(b('M'), b('a'))]) def test_tip(self): self.client.update(self.rev0) @@ -51,7 +52,7 @@ self.client.update(self.rev0) self.append('a', 'b') - rev2, node2 = self.client.commit('new head') + rev2, node2 = self.client.commit(b('new head')) self.client.update(self.rev0) self.client.update() @@ -85,13 +86,13 @@ f.close() self.append('b', 'a') try: - self.client.rawcommand(['add', 'b', '--large']) + self.client.rawcommand([b('add'), b('b'), b('--large')]) except error.CommandError: return - rev2, node2 = self.client.commit('third') + rev2, node2 = self.client.commit(b('third')) # Go back to 0 - self.client.rawcommand(['update', str(self.rev0)], + self.client.rawcommand([b('update'), str(self.rev0).encode('latin-1')], # Keep the 'changed' version prompt=lambda s, d: 'c\n') u, m, r, ur = self.client.update(rev2, clean=True)