Patchwork [1,of,2] ancestor: add test showing inconsistency between __iter__ and __contains__

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 8, 2018, 2:51 a.m.
Message ID <ebcd7abf0d144fb657b9.1536375073@mimosa>
Download mbox | patch
Permalink /patch/34409/
State Changes Requested
Headers show

Comments

Yuya Nishihara - Sept. 8, 2018, 2:51 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1536371322 -32400
#      Sat Sep 08 10:48:42 2018 +0900
# Node ID ebcd7abf0d144fb657b90126a1e30d13eefeb364
# Parent  a60dae060bc83e773bdbafb2432bc4cf387ebce2
ancestor: add test showing inconsistency between __iter__ and __contains__

Patch

diff --git a/tests/test-ancestor.py b/tests/test-ancestor.py
--- a/tests/test-ancestor.py
+++ b/tests/test-ancestor.py
@@ -215,6 +215,11 @@  def test_lazyancestors():
     s = genlazyancestors([11, 13], stoprev=6, inclusive=True)
     printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0])
 
+    # Test with stoprev >= min(initrevs)
+    s = genlazyancestors([11, 13], stoprev=11, inclusive=True)
+    printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0])
+    s = genlazyancestors([11, 13], stoprev=12, inclusive=True)
+    printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0])
 
 # The C gca algorithm requires a real repo. These are textual descriptions of
 # DAGs that have been known to be problematic, and, optionally, known pairs
diff --git a/tests/test-ancestor.py.out b/tests/test-ancestor.py.out
--- a/tests/test-ancestor.py.out
+++ b/tests/test-ancestor.py.out
@@ -16,3 +16,9 @@  iteration:  [8, 7]
 % lazy ancestor set for [11, 13], stoprev = 6, inclusive = True
 membership: [11, 13, 7, 8]
 iteration:  [13, 11, 8, 7]
+% lazy ancestor set for [11, 13], stoprev = 11, inclusive = True
+membership: [11, 13]
+iteration:  [13, 11]
+% lazy ancestor set for [11, 13], stoprev = 12, inclusive = True
+membership: [11, 13]
+iteration:  [13]