Mercurial > python-hglib
diff tests/test-commit.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 | dc63978871ed |
children | 3c59643a2bc3 |
line wrap: on
line diff
--- a/tests/test-commit.py Sun Mar 08 13:08:37 2015 -0400 +++ b/tests/test-commit.py Mon Mar 09 18:26:25 2015 -0400 @@ -1,24 +1,26 @@ import common, hglib, datetime +from hglib.util import b class test_commit(common.basetest): def test_user(self): self.append('a', 'a') - rev, node = self.client.commit('first', addremove=True, user='foo') + rev, node = self.client.commit(b('first'), addremove=True, + user=b('foo')) rev = self.client.log(node)[0] - self.assertEquals(rev.author, 'foo') + self.assertEquals(rev.author, b('foo')) def test_no_user(self): self.append('a', 'a') self.assertRaises(hglib.error.CommandError, - self.client.commit, 'first', user='') + self.client.commit, b('first'), user=b('')) def test_close_branch(self): self.append('a', 'a') - rev0, node0 = self.client.commit('first', addremove=True) - self.client.branch('foo') + rev0, node0 = self.client.commit(b('first'), addremove=True) + self.client.branch(b('foo')) self.append('a', 'a') - rev1, node1 = self.client.commit('second') - revclose = self.client.commit('closing foo', closebranch=True) + rev1, node1 = self.client.commit(b('second')) + revclose = self.client.commit(b('closing foo'), closebranch=True) rev0, rev1, revclose = self.client.log([node0, node1, revclose[1]]) self.assertEquals(self.client.branches(), @@ -30,22 +32,25 @@ (rev0.branch, int(rev0.rev), rev0.node[:12])]) def test_message_logfile(self): - self.assertRaises(ValueError, self.client.commit, 'foo', logfile='bar') + self.assertRaises(ValueError, self.client.commit, b('foo'), + logfile=b('bar')) self.assertRaises(ValueError, self.client.commit) def test_date(self): self.append('a', 'a') now = datetime.datetime.now().replace(microsecond=0) - rev0, node0 = self.client.commit('first', addremove=True, - date=now.isoformat(' ')) + rev0, node0 = self.client.commit( + b('first'), addremove=True, + date=now.isoformat(' ').encode('latin-1')) self.assertEquals(now, self.client.tip().date) def test_amend(self): self.append('a', 'a') now = datetime.datetime.now().replace(microsecond=0) - rev0, node0 = self.client.commit('first', addremove=True, - date=now.isoformat(' ')) + rev0, node0 = self.client.commit( + b('first'), addremove=True, + date=now.isoformat(' ').encode('latin-1')) print rev0, node0 self.assertEquals(now, self.client.tip().date) @@ -56,4 +61,3 @@ self.assertEquals(now, self.client.tip().date) self.assertNotEquals(node0, node1) self.assertEqual(1, len(self.client.log())) -