# HG changeset patch # User Maciej Fijalkowski # Date 1459442288 -7200 # Node ID c5f212c8ad78a250e22d1fb40bafa8a431f37cce # Parent 5c14af475f61f1a2dcd19a1f10a3d03a87ca936b pypy: fix doctests for pypy optimizations PyPy would sometime call __len__ at points where it things preallocating the container makes sense. Change the doctests so they're using generator expressions and not list comprehensions diff -r 5c14af475f61 -r c5f212c8ad78 mercurial/revset.py --- a/mercurial/revset.py Sat Mar 19 15:31:13 2016 +0100 +++ b/mercurial/revset.py Thu Mar 31 18:38:08 2016 +0200 @@ -3060,7 +3060,8 @@ iterate unsorted: >>> rs = addset(xs, ys) - >>> [x for x in rs] # without _genlist + >>> # (use generator because pypy could call len()) + >>> list(x for x in rs) # without _genlist [0, 3, 2, 5, 4] >>> assert not rs._genlist >>> len(rs) @@ -3071,7 +3072,8 @@ iterate ascending: >>> rs = addset(xs, ys, ascending=True) - >>> [x for x in rs], [x for x in rs.fastasc()] # without _asclist + >>> # (use generator because pypy could call len()) + >>> list(x for x in rs), list(x for x in rs.fastasc()) # without _asclist ([0, 2, 3, 4, 5], [0, 2, 3, 4, 5]) >>> assert not rs._asclist >>> len(rs) @@ -3082,7 +3084,8 @@ iterate descending: >>> rs = addset(xs, ys, ascending=False) - >>> [x for x in rs], [x for x in rs.fastdesc()] # without _asclist + >>> # (use generator because pypy could call len()) + >>> list(x for x in rs), list(x for x in rs.fastdesc()) # without _asclist ([5, 4, 3, 2, 0], [5, 4, 3, 2, 0]) >>> assert not rs._asclist >>> len(rs)