From 91b0e85f1701d335dfac87c9f569f8e5fe9bdad5 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Sun, 26 Aug 2007 09:41:39 +0000 Subject: [PATCH] fixed small but crucial cmp test bug when repopulating the stack --- direct/src/showbase/LazySort.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/direct/src/showbase/LazySort.py b/direct/src/showbase/LazySort.py index 9f8a45050b..f0b95f5c38 100755 --- a/direct/src/showbase/LazySort.py +++ b/direct/src/showbase/LazySort.py @@ -103,24 +103,25 @@ def itersorted(iterable, cmp = cmp, key = lambda x: x, reverse = False): yield val pass -def test(): - import random - from itertools import islice - - control = sorted(data, key = lambda x: x[0]) - variable = itersorted(data, key = lambda x: x[0]) - - print control[:10] == [x for x in islice(variable,10)] - print data - print control - - variable = itersorted(data, key = lambda x: x[0]) - print [x for x in islice(variable,10)] if __debug__: def P(i): for x in reversed(i): print x + def test(): + import random + from itertools import islice + + control = sorted(data, key = lambda x: x[0]) + variable = itersorted(data, key = lambda x: x[0]) + + print control[:10] == [x for x in islice(variable,10)] + print data + print control + + variable = itersorted(data, key = lambda x: x[0]) + print [x for x in islice(variable,10)] + from unittest import TestCase, main from random import shuffle from itertools import islice