changeset 43946:ac627ed8a911

tests-pure: fixing test-parseindex2 This is a followup to D7603 (49fa0b31ee1d) which broke the tests for pure Python implementation. There are two divergences between pure and C implementations: - the pure implementation would accept only -1 as slice end, whereas C accepts both -1 and len(index) - in pure Python, `headrevs` is provided by revlog.py, not by the index. Differential Revision: https://phab.mercurial-scm.org/D7707
author Georges Racinet <georges.racinet@octobus.net>
date Fri, 20 Dec 2019 17:19:25 +0100
parents f98f0e3ddaa1
children 9595b6a9f0d5
files tests/test-parseindex2.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-parseindex2.py	Fri Dec 13 19:59:59 2019 +0100
+++ b/tests/test-parseindex2.py	Fri Dec 20 17:19:25 2019 +0100
@@ -267,11 +267,13 @@
         appendrev(6)
         self.assertEqual(len(index), 7)
 
-        del index[1:7]
+        del index[1:-1]
 
         # assertions that failed before correction
         self.assertEqual(len(index), 1)  # was 4
-        self.assertEqual(index.headrevs(), [0])  # gave ValueError
+        headrevs = getattr(index, 'headrevs', None)
+        if headrevs is not None:  # not implemented in pure
+            self.assertEqual(index.headrevs(), [0])  # gave ValueError
 
 
 if __name__ == '__main__':