comparison tests/test-annotate.py @ 35947:a36d3c8a0e41

py3: add b'' prefixes to string literals in test files # skip-blame because we are just adding b'' Differential Revision: https://phab.mercurial-scm.org/D2075
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 07 Feb 2018 13:34:51 +0530
parents cf887d601014
children 7affcabf561e
comparison
equal deleted inserted replaced
35946:cf887d601014 35947:a36d3c8a0e41
34 34
35 oldann = decorate(olddata, oldfctx) 35 oldann = decorate(olddata, oldfctx)
36 p1ann = decorate(p1data, p1fctx) 36 p1ann = decorate(p1data, p1fctx)
37 p1ann = _annotatepair([oldann], p1fctx, p1ann, False, diffopts) 37 p1ann = _annotatepair([oldann], p1fctx, p1ann, False, diffopts)
38 self.assertEqual(p1ann[0], [ 38 self.assertEqual(p1ann[0], [
39 annotateline('old', 1), 39 annotateline(b'old', 1),
40 annotateline('old', 2), 40 annotateline(b'old', 2),
41 annotateline('p1', 3), 41 annotateline(b'p1', 3),
42 ]) 42 ])
43 43
44 p2ann = decorate(p2data, p2fctx) 44 p2ann = decorate(p2data, p2fctx)
45 p2ann = _annotatepair([oldann], p2fctx, p2ann, False, diffopts) 45 p2ann = _annotatepair([oldann], p2fctx, p2ann, False, diffopts)
46 self.assertEqual(p2ann[0], [ 46 self.assertEqual(p2ann[0], [
47 annotateline('old', 1), 47 annotateline(b'old', 1),
48 annotateline('p2', 2), 48 annotateline(b'p2', 2),
49 annotateline('p2', 3), 49 annotateline(b'p2', 3),
50 ]) 50 ])
51 51
52 # Test with multiple parents (note the difference caused by ordering) 52 # Test with multiple parents (note the difference caused by ordering)
53 53
54 childann = decorate(childdata, childfctx) 54 childann = decorate(childdata, childfctx)
55 childann = _annotatepair([p1ann, p2ann], childfctx, childann, False, 55 childann = _annotatepair([p1ann, p2ann], childfctx, childann, False,
56 diffopts) 56 diffopts)
57 self.assertEqual(childann[0], [ 57 self.assertEqual(childann[0], [
58 annotateline('old', 1), 58 annotateline(b'old', 1),
59 annotateline('c', 2), 59 annotateline(b'c', 2),
60 annotateline('p2', 2), 60 annotateline(b'p2', 2),
61 annotateline('c', 4), 61 annotateline(b'c', 4),
62 annotateline('p2', 3), 62 annotateline(b'p2', 3),
63 ]) 63 ])
64 64
65 childann = decorate(childdata, childfctx) 65 childann = decorate(childdata, childfctx)
66 childann = _annotatepair([p2ann, p1ann], childfctx, childann, False, 66 childann = _annotatepair([p2ann, p1ann], childfctx, childann, False,
67 diffopts) 67 diffopts)
68 self.assertEqual(childann[0], [ 68 self.assertEqual(childann[0], [
69 annotateline('old', 1), 69 annotateline(b'old', 1),
70 annotateline('c', 2), 70 annotateline(b'c', 2),
71 annotateline('p1', 3), 71 annotateline(b'p1', 3),
72 annotateline('c', 4), 72 annotateline(b'c', 4),
73 annotateline('p2', 3), 73 annotateline(b'p2', 3),
74 ]) 74 ])
75 75
76 # Test with skipchild (note the difference caused by ordering) 76 # Test with skipchild (note the difference caused by ordering)
77 77
78 childann = decorate(childdata, childfctx) 78 childann = decorate(childdata, childfctx)
79 childann = _annotatepair([p1ann, p2ann], childfctx, childann, True, 79 childann = _annotatepair([p1ann, p2ann], childfctx, childann, True,
80 diffopts) 80 diffopts)
81 self.assertEqual(childann[0], [ 81 self.assertEqual(childann[0], [
82 annotateline('old', 1), 82 annotateline(b'old', 1),
83 annotateline('old', 2, True), 83 annotateline(b'old', 2, True),
84 # note that this line was carried over from earlier so it is *not* 84 # note that this line was carried over from earlier so it is *not*
85 # marked skipped 85 # marked skipped
86 annotateline('p2', 2), 86 annotateline(b'p2', 2),
87 annotateline('p2', 2, True), 87 annotateline(b'p2', 2, True),
88 annotateline('p2', 3), 88 annotateline(b'p2', 3),
89 ]) 89 ])
90 90
91 childann = decorate(childdata, childfctx) 91 childann = decorate(childdata, childfctx)
92 childann = _annotatepair([p2ann, p1ann], childfctx, childann, True, 92 childann = _annotatepair([p2ann, p1ann], childfctx, childann, True,
93 diffopts) 93 diffopts)
94 self.assertEqual(childann[0], [ 94 self.assertEqual(childann[0], [
95 annotateline('old', 1), 95 annotateline(b'old', 1),
96 annotateline('old', 2, True), 96 annotateline(b'old', 2, True),
97 annotateline('p1', 3), 97 annotateline(b'p1', 3),
98 annotateline('p1', 3, True), 98 annotateline(b'p1', 3, True),
99 annotateline('p2', 3), 99 annotateline(b'p2', 3),
100 ]) 100 ])
101 101
102 if __name__ == '__main__': 102 if __name__ == '__main__':
103 import silenttestrunner 103 import silenttestrunner
104 silenttestrunner.main(__name__) 104 silenttestrunner.main(__name__)