Mercurial > hg
changeset 24569:5491248e148a
test-manifest: create constant for empty manifest
For symmetry with manifest v2, once we add that, let's extract a
constant for the empty v1 manifest.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 31 Mar 2015 14:46:05 -0700 |
parents | 2e5f6cdf01f6 |
children | 487245cbf1ab |
files | tests/test-manifest.py |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-manifest.py Mon Mar 30 23:25:55 2015 +0900 +++ b/tests/test-manifest.py Tue Mar 31 14:46:05 2015 -0700 @@ -7,6 +7,8 @@ from mercurial import manifest as manifestmod from mercurial import match as matchmod +EMTPY_MANIFEST = '' + HASH_1 = '1' * 40 HASH_2 = 'f' * 40 HASH_3 = '1234567890abcdef0987654321deadbeef0fcafe' @@ -68,7 +70,7 @@ self.assert_(thing in container, msg) def testEmptyManifest(self): - m = parsemanifest('') + m = parsemanifest(EMTPY_MANIFEST) self.assertEqual(0, len(m)) self.assertEqual([], list(m)) @@ -84,7 +86,7 @@ def testSetItem(self): want = binascii.unhexlify(HASH_1) - m = parsemanifest('') + m = parsemanifest(EMTPY_MANIFEST) m['a'] = want self.assertIn('a', m) self.assertEqual(want, m['a']) @@ -99,7 +101,7 @@ def testSetFlag(self): want = 'x' - m = parsemanifest('') + m = parsemanifest(EMTPY_MANIFEST) # first add a file; a file-less flag makes no sense m['a'] = binascii.unhexlify(HASH_1) m.setflag('a', want) @@ -214,14 +216,14 @@ 'foo': (MISSING, (binascii.unhexlify(HASH_3), 'x')), 'z-only-in-left': (MISSING, (binascii.unhexlify(HASH_1), '')), } - self.assertEqual(want, parsemanifest('').diff(left)) + self.assertEqual(want, parsemanifest(EMTPY_MANIFEST).diff(left)) want = { 'bar/baz/qux.py': ((binascii.unhexlify(HASH_2), 'l'), MISSING), 'foo': ((binascii.unhexlify(HASH_3), 'x'), MISSING), 'z-only-in-left': ((binascii.unhexlify(HASH_1), ''), MISSING), } - self.assertEqual(want, left.diff(parsemanifest(''))) + self.assertEqual(want, left.diff(parsemanifest(EMTPY_MANIFEST))) copy = right.copy() del copy['z-only-in-right'] del right['foo']