comparison tests/test-rust-discovery.py @ 43076:2372284d9457

formatting: blacken the codebase This is using my patch to black (https://github.com/psf/black/pull/826) so we don't un-wrap collection literals. Done with: hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S # skip-blame mass-reformatting only # no-check-commit reformats foo_bar functions Differential Revision: https://phab.mercurial-scm.org/D6971
author Augie Fackler <augie@google.com>
date Sun, 06 Oct 2019 09:45:02 -0400
parents 791791a1fd4e
children 6000f5b25c9b
comparison
equal deleted inserted replaced
43075:57875cf423c9 43076:2372284d9457
27 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01F' 27 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01F'
28 b'\x13\x00\x00\x00\x00\x01\xec\x00\x00\x03\x06\x00\x00\x00\x01' 28 b'\x13\x00\x00\x00\x00\x01\xec\x00\x00\x03\x06\x00\x00\x00\x01'
29 b'\x00\x00\x00\x03\x00\x00\x00\x02\xff\xff\xff\xff\x12\xcb\xeby1' 29 b'\x00\x00\x00\x03\x00\x00\x00\x02\xff\xff\xff\xff\x12\xcb\xeby1'
30 b'\xb6\r\x98B\xcb\x07\xbd`\x8f\x92\xd9\xc4\x84\xbdK\x00\x00\x00' 30 b'\xb6\r\x98B\xcb\x07\xbd`\x8f\x92\xd9\xc4\x84\xbdK\x00\x00\x00'
31 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00' 31 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00'
32 ) 32 )
33
33 34
34 class fakechangelog(object): 35 class fakechangelog(object):
35 def __init__(self, idx): 36 def __init__(self, idx):
36 self.index = idx 37 self.index = idx
38
37 39
38 class fakerepo(object): 40 class fakerepo(object):
39 def __init__(self, idx): 41 def __init__(self, idx):
40 """Just make so that self.changelog.index is the given idx.""" 42 """Just make so that self.changelog.index is the given idx."""
41 self.changelog = fakechangelog(idx) 43 self.changelog = fakechangelog(idx)
42 44
43 @unittest.skipIf(PartialDiscovery is None or cparsers is None, 45
44 "rustext or the C Extension parsers module " 46 @unittest.skipIf(
45 "discovery relies on is not available") 47 PartialDiscovery is None or cparsers is None,
48 "rustext or the C Extension parsers module "
49 "discovery relies on is not available",
50 )
46 class rustdiscoverytest(unittest.TestCase): 51 class rustdiscoverytest(unittest.TestCase):
47 """Test the correctness of binding to Rust code. 52 """Test the correctness of binding to Rust code.
48 53
49 This test is merely for the binding to Rust itself: extraction of 54 This test is merely for the binding to Rust itself: extraction of
50 Python variable, giving back the results etc. 55 Python variable, giving back the results etc.
62 return fakerepo(self.parseindex()) 67 return fakerepo(self.parseindex())
63 68
64 def testindex(self): 69 def testindex(self):
65 idx = self.parseindex() 70 idx = self.parseindex()
66 # checking our assumptions about the index binary data: 71 # checking our assumptions about the index binary data:
67 self.assertEqual({i: (r[5], r[6]) for i, r in enumerate(idx)}, 72 self.assertEqual(
68 {0: (-1, -1), 73 {i: (r[5], r[6]) for i, r in enumerate(idx)},
69 1: (0, -1), 74 {0: (-1, -1), 1: (0, -1), 2: (1, -1), 3: (2, -1)},
70 2: (1, -1), 75 )
71 3: (2, -1)})
72 76
73 def testaddcommonsmissings(self): 77 def testaddcommonsmissings(self):
74 disco = PartialDiscovery(self.repo(), [3], True) 78 disco = PartialDiscovery(self.repo(), [3], True)
75 self.assertFalse(disco.hasinfo()) 79 self.assertFalse(disco.hasinfo())
76 self.assertFalse(disco.iscomplete()) 80 self.assertFalse(disco.iscomplete())
107 self.assertEqual(disco.commonheads(), {1}) 111 self.assertEqual(disco.commonheads(), {1})
108 112
109 def testinitnorandom(self): 113 def testinitnorandom(self):
110 PartialDiscovery(self.repo(), [3], True, randomize=False) 114 PartialDiscovery(self.repo(), [3], True, randomize=False)
111 115
116
112 if __name__ == '__main__': 117 if __name__ == '__main__':
113 import silenttestrunner 118 import silenttestrunner
119
114 silenttestrunner.main(__name__) 120 silenttestrunner.main(__name__)