Mercurial > python-hglib
comparison 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 |
comparison
equal
deleted
inserted
replaced
142:fe74d5599539 | 143:4359cabcb0cc |
---|---|
1 import common, hglib | 1 import common, hglib |
2 from hglib.util import b | |
2 | 3 |
3 class test_phase(common.basetest): | 4 class test_phase(common.basetest): |
4 """test the different ways to use the phase command""" | 5 """test the different ways to use the phase command""" |
5 def test_phase(self): | 6 def test_phase(self): |
6 """test getting data from a single changeset""" | 7 """test getting data from a single changeset""" |
7 self.append('a', 'a') | 8 self.append('a', 'a') |
8 rev, node0 = self.client.commit('first', addremove=True) | 9 rev, node0 = self.client.commit(b('first'), addremove=True) |
9 self.assertEqual([(0, 'draft')], self.client.phase(node0)) | 10 self.assertEqual([(0, b('draft'))], self.client.phase(node0)) |
10 ctx = self.client[rev] | 11 ctx = self.client[rev] |
11 self.assertEqual('draft', ctx.phase()) | 12 self.assertEqual(b('draft'), ctx.phase()) |
12 | 13 |
13 def test_phase_public(self): | 14 def test_phase_public(self): |
14 """test phase change from draft to public""" | 15 """test phase change from draft to public""" |
15 self.append('a', 'a') | 16 self.append('a', 'a') |
16 rev, node0 = self.client.commit('first', addremove=True) | 17 rev, node0 = self.client.commit(b('first'), addremove=True) |
17 self.client.phase(node0, public=True) | 18 self.client.phase(node0, public=True) |
18 self.assertEqual([(0, 'public')], self.client.phase(node0)) | 19 self.assertEqual([(0, b('public'))], self.client.phase(node0)) |
19 ctx = self.client[rev] | 20 ctx = self.client[rev] |
20 self.assertEqual('public', ctx.phase()) | 21 self.assertEqual(b('public'), ctx.phase()) |
21 | 22 |
22 def test_phase_secret(self): | 23 def test_phase_secret(self): |
23 """test phase change from draft to secret""" | 24 """test phase change from draft to secret""" |
24 self.append('a', 'a') | 25 self.append('a', 'a') |
25 rev, node0 = self.client.commit('first', addremove=True) | 26 rev, node0 = self.client.commit(b('first'), addremove=True) |
26 self.assertRaises(hglib.error.CommandError, | 27 self.assertRaises(hglib.error.CommandError, |
27 self.client.phase, node0, secret=True) | 28 self.client.phase, node0, secret=True) |
28 self.client.phase(node0, secret=True, force=True) | 29 self.client.phase(node0, secret=True, force=True) |
29 self.assertEqual([(0, 'secret')], self.client.phase(node0)) | 30 self.assertEqual([(0, b('secret'))], self.client.phase(node0)) |
30 ctx = self.client[rev] | 31 ctx = self.client[rev] |
31 self.assertEqual('secret', ctx.phase()) | 32 self.assertEqual(b('secret'), ctx.phase()) |
32 | 33 |
33 | 34 |
34 def test_phase_multiple(self): | 35 def test_phase_multiple(self): |
35 """test phase changes and show the phases of the different changesets""" | 36 """test phase changes and show the phases of the different changesets""" |
36 self.append('a', 'a') | 37 self.append('a', 'a') |
37 rev, node0 = self.client.commit('a', addremove=True) | 38 rev, node0 = self.client.commit(b('a'), addremove=True) |
38 self.client.phase(node0, public=True) | 39 self.client.phase(node0, public=True) |
39 self.append('b', 'b') | 40 self.append('b', 'b') |
40 rev, node1 = self.client.commit('b', addremove=True) | 41 rev, node1 = self.client.commit(b('b'), addremove=True) |
41 self.append('c', 'c') | 42 self.append('c', 'c') |
42 rev, node2 = self.client.commit('c', addremove=True) | 43 rev, node2 = self.client.commit(b('c'), addremove=True) |
43 self.client.phase(node2, secret=True, force=True) | 44 self.client.phase(node2, secret=True, force=True) |
44 self.assertEqual([(0, 'public'), (2, 'secret'), (1, 'draft')], | 45 self.assertEqual([(0, b('public')), (2, b('secret')), (1, b('draft'))], |
45 self.client.phase([node0, node2, node1])) | 46 self.client.phase([node0, node2, node1])) |