diff tests/test-phase.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 b6f601ba7f3c
children c1b966866ed7
line wrap: on
line diff
--- a/tests/test-phase.py	Sun Mar 08 13:08:37 2015 -0400
+++ b/tests/test-phase.py	Mon Mar 09 18:26:25 2015 -0400
@@ -1,45 +1,46 @@
 import common, hglib
+from hglib.util import b
 
 class test_phase(common.basetest):
     """test the different ways to use the phase command"""
     def test_phase(self):
         """test getting data from a single changeset"""
         self.append('a', 'a')
-        rev, node0 = self.client.commit('first', addremove=True)
-        self.assertEqual([(0, 'draft')], self.client.phase(node0))
+        rev, node0 = self.client.commit(b('first'), addremove=True)
+        self.assertEqual([(0, b('draft'))], self.client.phase(node0))
         ctx = self.client[rev]
-        self.assertEqual('draft', ctx.phase())
+        self.assertEqual(b('draft'), ctx.phase())
 
     def test_phase_public(self):
         """test phase change from draft to public"""
         self.append('a', 'a')
-        rev, node0 = self.client.commit('first', addremove=True)
+        rev, node0 = self.client.commit(b('first'), addremove=True)
         self.client.phase(node0, public=True)
-        self.assertEqual([(0, 'public')], self.client.phase(node0))
+        self.assertEqual([(0, b('public'))], self.client.phase(node0))
         ctx = self.client[rev]
-        self.assertEqual('public', ctx.phase())
+        self.assertEqual(b('public'), ctx.phase())
 
     def test_phase_secret(self):
         """test phase change from draft to secret"""
         self.append('a', 'a')
-        rev, node0 = self.client.commit('first', addremove=True)
+        rev, node0 = self.client.commit(b('first'), addremove=True)
         self.assertRaises(hglib.error.CommandError,
                           self.client.phase, node0, secret=True)
         self.client.phase(node0, secret=True, force=True)
-        self.assertEqual([(0, 'secret')], self.client.phase(node0))
+        self.assertEqual([(0, b('secret'))], self.client.phase(node0))
         ctx = self.client[rev]
-        self.assertEqual('secret', ctx.phase())
+        self.assertEqual(b('secret'), ctx.phase())
 
 
     def test_phase_multiple(self):
         """test phase changes and show the phases of the different changesets"""
         self.append('a', 'a')
-        rev, node0 = self.client.commit('a', addremove=True)
+        rev, node0 = self.client.commit(b('a'), addremove=True)
         self.client.phase(node0, public=True)
         self.append('b', 'b')
-        rev, node1 = self.client.commit('b', addremove=True)
+        rev, node1 = self.client.commit(b('b'), addremove=True)
         self.append('c', 'c')
-        rev, node2 = self.client.commit('c', addremove=True)
+        rev, node2 = self.client.commit(b('c'), addremove=True)
         self.client.phase(node2, secret=True, force=True)
-        self.assertEqual([(0, 'public'), (2, 'secret'), (1, 'draft')],
+        self.assertEqual([(0, b('public')), (2, b('secret')), (1, b('draft'))],
                          self.client.phase([node0, node2, node1]))