Mercurial > python-hglib
comparison tests/test_summary.py @ 221:a2afbf236ca8
hglib tests: remove deprecated constructions
This mostly removes usage of 'assertEquals' (replaced with 'assertEqual'),
as well as opening files without closing them
(fixed using a 'with' statement).
author | Mathias De Mare <mathias.de_mare@nokia.com> |
---|---|
date | Thu, 09 Mar 2023 14:00:02 +0100 |
parents | 8341f2494b3f |
children |
comparison
equal
deleted
inserted
replaced
220:ae6427d1c8f7 | 221:a2afbf236ca8 |
---|---|
8 d = {b('parent') : [(-1, b('000000000000'), b('tip'), None)], | 8 d = {b('parent') : [(-1, b('000000000000'), b('tip'), None)], |
9 b('branch') : b('default'), | 9 b('branch') : b('default'), |
10 b('commit') : True, | 10 b('commit') : True, |
11 b('update') : 0} | 11 b('update') : 0} |
12 | 12 |
13 self.assertEquals(self.client.summary(), d) | 13 self.assertEqual(self.client.summary(), d) |
14 | 14 |
15 def test_basic(self): | 15 def test_basic(self): |
16 self.append('a', 'a') | 16 self.append('a', 'a') |
17 rev, node = self.client.commit(b('first'), addremove=True) | 17 rev, node = self.client.commit(b('first'), addremove=True) |
18 | 18 |
21 b('commit') : True, | 21 b('commit') : True, |
22 b('update') : 0} | 22 b('update') : 0} |
23 if self.client.version >= (3, 5): | 23 if self.client.version >= (3, 5): |
24 d[b('phases')] = b('1 draft') | 24 d[b('phases')] = b('1 draft') |
25 | 25 |
26 self.assertEquals(self.client.summary(), d) | 26 self.assertEqual(self.client.summary(), d) |
27 | 27 |
28 def test_commit_dirty(self): | 28 def test_commit_dirty(self): |
29 self.append('a', 'a') | 29 self.append('a', 'a') |
30 rev, node = self.client.commit(b('first'), addremove=True) | 30 rev, node = self.client.commit(b('first'), addremove=True) |
31 self.append('a', 'a') | 31 self.append('a', 'a') |
35 b('commit') : False, | 35 b('commit') : False, |
36 b('update') : 0} | 36 b('update') : 0} |
37 if self.client.version >= (3, 5): | 37 if self.client.version >= (3, 5): |
38 d[b('phases')] = b('1 draft') | 38 d[b('phases')] = b('1 draft') |
39 | 39 |
40 self.assertEquals(self.client.summary(), d) | 40 self.assertEqual(self.client.summary(), d) |
41 | 41 |
42 def test_secret_commit_clean(self): | 42 def test_secret_commit_clean(self): |
43 if self.client.version < (2, 1): | 43 if self.client.version < (2, 1): |
44 raise unittest.SkipTest('phase not supported') | 44 raise unittest.SkipTest('phase not supported') |
45 self.append('a', 'a') | 45 self.append('a', 'a') |
60 b('commit') : True, | 60 b('commit') : True, |
61 b('update') : 1} | 61 b('update') : 1} |
62 if self.client.version >= (3, 5): | 62 if self.client.version >= (3, 5): |
63 d[b('phases')] = b('2 draft') | 63 d[b('phases')] = b('2 draft') |
64 | 64 |
65 self.assertEquals(self.client.summary(), d) | 65 self.assertEqual(self.client.summary(), d) |
66 | 66 |
67 def test_remote(self): | 67 def test_remote(self): |
68 self.append('a', 'a') | 68 self.append('a', 'a') |
69 rev, node = self.client.commit(b('first'), addremove=True) | 69 rev, node = self.client.commit(b('first'), addremove=True) |
70 | 70 |
75 b('branch') : b('default'), | 75 b('branch') : b('default'), |
76 b('commit') : True, | 76 b('commit') : True, |
77 b('update') : 0, | 77 b('update') : 0, |
78 b('remote') : (0, 0, 0, 0)} | 78 b('remote') : (0, 0, 0, 0)} |
79 | 79 |
80 self.assertEquals(other.summary(remote=True), d) | 80 self.assertEqual(other.summary(remote=True), d) |
81 | 81 |
82 self.append('a', 'a') | 82 self.append('a', 'a') |
83 self.client.commit(b('second')) | 83 self.client.commit(b('second')) |
84 | 84 |
85 d[b('remote')] = (1, 0, 0, 0) | 85 d[b('remote')] = (1, 0, 0, 0) |
86 self.assertEquals(other.summary(remote=True), d) | 86 self.assertEqual(other.summary(remote=True), d) |
87 | 87 |
88 self.client.bookmark(b('bm')) | 88 self.client.bookmark(b('bm')) |
89 d[b('remote')] = (1, 1, 0, 0) | 89 d[b('remote')] = (1, 1, 0, 0) |
90 self.assertEquals(other.summary(remote=True), d) | 90 self.assertEqual(other.summary(remote=True), d) |
91 | 91 |
92 other.bookmark(b('bmother')) | 92 other.bookmark(b('bmother')) |
93 d[b('remote')] = (1, 1, 0, 1) | 93 d[b('remote')] = (1, 1, 0, 1) |
94 if self.client.version < (2, 0, 0): | 94 if self.client.version < (2, 0, 0): |
95 d[b('parent')] = [(0, node[:12], b('tip bmother'), b('first'))] | 95 d[b('parent')] = [(0, node[:12], b('tip bmother'), b('first'))] |
96 else: | 96 else: |
97 d[b('bookmarks')] = b('*bmother') | 97 d[b('bookmarks')] = b('*bmother') |
98 self.assertEquals(other.summary(remote=True), d) | 98 self.assertEqual(other.summary(remote=True), d) |
99 | 99 |
100 self.append('other/a', 'a') | 100 self.append('other/a', 'a') |
101 rev, node = other.commit(b('second in other')) | 101 rev, node = other.commit(b('second in other')) |
102 | 102 |
103 d[b('remote')] = (1, 1, 1, 1) | 103 d[b('remote')] = (1, 1, 1, 1) |
107 tags = b('tip') | 107 tags = b('tip') |
108 d[b('parent')] = [(1, node[:12], tags, b('second in other'))] | 108 d[b('parent')] = [(1, node[:12], tags, b('second in other'))] |
109 if self.client.version >= (3, 5): | 109 if self.client.version >= (3, 5): |
110 d[b('phases')] = b('1 draft') | 110 d[b('phases')] = b('1 draft') |
111 | 111 |
112 self.assertEquals(other.summary(remote=True), d) | 112 self.assertEqual(other.summary(remote=True), d) |
113 | 113 |
114 def test_two_parents(self): | 114 def test_two_parents(self): |
115 self.append('a', 'a') | 115 self.append('a', 'a') |
116 rev0, node = self.client.commit(b('first'), addremove=True) | 116 rev0, node = self.client.commit(b('first'), addremove=True) |
117 | 117 |
130 b('commit') : False, | 130 b('commit') : False, |
131 b('update') : 0} | 131 b('update') : 0} |
132 if self.client.version >= (3, 5): | 132 if self.client.version >= (3, 5): |
133 d[b('phases')] = b('3 draft') | 133 d[b('phases')] = b('3 draft') |
134 | 134 |
135 self.assertEquals(self.client.summary(), d) | 135 self.assertEqual(self.client.summary(), d) |