@@ -50,17 +50,27 @@ def check_entries(d):
50
50
51
51
def test_traversal (self ):
52
52
start = self .rorepo .commit ("a4d06724202afccd2b5c54f81bcf2bf26dea7fff" )
53
+ first = self .rorepo .commit ("33ebe7acec14b25c5f84f35a664803fcab2f7781" )
53
54
p0 = start .parents [0 ]
54
55
p1 = start .parents [1 ]
55
56
p00 = p0 .parents [0 ]
57
+ p10 = p1 .parents [0 ]
56
58
57
59
# basic branch first, depth first
58
60
dfirst = start .traverse (branch_first = False )
59
- bfirts = start .traverse (branch_first = True )
61
+ bfirst = start .traverse (branch_first = True )
60
62
assert dfirst .next () == p0
61
63
assert dfirst .next () == p00
62
- assert bfirts .next () == p0
63
- assert bfirts .next () == p1
64
+
65
+ assert bfirst .next () == p0
66
+ assert bfirst .next () == p1
67
+ assert bfirst .next () == p00
68
+ assert bfirst .next () == p10
69
+
70
+ # at some point, both iterations should stop
71
+ assert list (dfirst )[- 1 ] == first
72
+ assert list (bfirst )[- 1 ] == first
73
+
64
74
65
75
# ignore self
66
76
assert start .traverse (ignore_self = False ).next () == start
@@ -74,6 +84,9 @@ def test_traversal(self):
74
84
# predicate
75
85
assert start .traverse (branch_first = 1 , predicate = lambda i ,d : i == p1 ).next () == p1
76
86
87
+ # traversal should stop when the beginning is reached
88
+ self .failUnlessRaises (StopIteration , first .traverse ().next )
89
+
77
90
@patch_object (Git , '_call_process' )
78
91
def test_rev_list_bisect_all (self , git ):
79
92
"""
0 commit comments