[pypy-commit] pypy default: Add a test for range().sort(key=). It works, but you have not

arigo noreply at buildbot.pypy.org
Wed Aug 31 10:23:02 CEST 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r46938:a3a90cb98864
Date: 2011-08-30 04:56 +0200
http://bitbucket.org/pypy/pypy/changeset/a3a90cb98864/

Log:	Add a test for range().sort(key=). It works, but you have not to
	blink when looking at the list_sort implementation of ranges.

diff --git a/pypy/objspace/std/test/test_rangeobject.py b/pypy/objspace/std/test/test_rangeobject.py
--- a/pypy/objspace/std/test/test_rangeobject.py
+++ b/pypy/objspace/std/test/test_rangeobject.py
@@ -89,6 +89,9 @@
         assert not self.not_forced(r)
         r.sort()
         assert r == range(1, 100) + [999]
+        r = range(10)
+        r.sort(key=lambda x: -x)
+        assert r == range(9, -1, -1)
 
     def test_pop(self):
         r = range(10)


More information about the pypy-commit mailing list