# Patchwork [02,of,16] test-ancestor: test iteration for lazyancestors

Submitter Siddharth Agarwal Nov. 16, 2014, 9:17 a.m. <0acf7d8386ab7425f041.1416129424@devbig136.prn2.facebook.com> mbox | patch /patch/6748/ Accepted c6cd4b8b76f829724c54d91111e0a0e861c7a82f show

Siddharth Agarwal - Nov. 16, 2014, 9:17 a.m.
```# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1416005403 28800
#      Fri Nov 14 14:50:03 2014 -0800
# Node ID 0acf7d8386ab7425f041458fd021a23605fa2a5d
test-ancestor: test iteration for lazyancestors

This has some test coverage in test-revlog-ancestry.py, but not very much.
```

## Patch

```diff --git a/tests/test-ancestor.py b/tests/test-ancestor.py
--- a/tests/test-ancestor.py
+++ b/tests/test-ancestor.py
@@ -77,7 +77,8 @@
inclusive=inclusive)

def printlazyancestors(s, l):
-    print [n for n in l if n in s]
+    print 'membership: %r' % [n for n in l if n in s]
+    print 'iteration:  %r' % list(s)

def test_lazyancestors():
# Empty revs
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
@@ -35,14 +35,20 @@
% ancestors of [13] and not of [10, 11, 12]
[8, 13]
% lazy ancestor set for [], stoprev = 0, inclusive = False
-[]
+membership: []
+iteration:  []
% lazy ancestor set for [11, 13], stoprev = 0, inclusive = False
-[7, 8, 3, 4, 1, 0]
+membership: [7, 8, 3, 4, 1, 0]
+iteration:  [3, 7, 8, 1, 4, 0, 2]
% lazy ancestor set for [1, 3], stoprev = 0, inclusive = False
-[1, 0]
+membership: [1, 0]
+iteration:  [0, 1]
% lazy ancestor set for [11, 13], stoprev = 0, inclusive = True
-[11, 13, 7, 8, 3, 4, 1, 0]
+membership: [11, 13, 7, 8, 3, 4, 1, 0]
+iteration:  [11, 13, 3, 7, 8, 1, 4, 0, 2]
% lazy ancestor set for [11, 13], stoprev = 6, inclusive = False
-[7, 8]
+membership: [7, 8]
+iteration:  [7, 8]
% lazy ancestor set for [11, 13], stoprev = 6, inclusive = True
-[11, 13, 7, 8]
+membership: [11, 13, 7, 8]
+iteration:  [11, 13, 7, 8]

```