[pypy-commit] pypy list-strategies: added test + fix for simplesort with strings
l.diekmann
noreply at buildbot.pypy.org
Fri Sep 23 13:15:08 CEST 2011
Author: Lukas Diekmann <lukas.diekmann at uni-duesseldorf.de>
Branch: list-strategies
Changeset: r47537:9e8a62191be2
Date: 2011-09-06 13:38 +0200
http://bitbucket.org/pypy/pypy/changeset/9e8a62191be2/
Log: added test + fix for simplesort with strings
diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -1171,8 +1171,8 @@
class StringSort(SimpleSort):
def lt(self, w_str1, w_str2):
from pypy.objspace.std.stringobject import W_StringObject
- assert isinstance(w_int1, W_StringObject)
- assert isinstance(w_int2, W_StringObject)
+ assert isinstance(w_str1, W_StringObject)
+ assert isinstance(w_str2, W_StringObject)
space = self.space
return w_str1._value < w_str2._value
diff --git a/pypy/objspace/std/test/test_listobject.py b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -471,6 +471,11 @@
l.sort(reverse = True, key = lower)
assert l == ['C', 'b', 'a']
+ def test_sort_simple_string(self):
+ l = ["a", "d", "c", "b"]
+ l.sort()
+ assert l == ["a", "b", "c", "d"]
+
def test_getitem(self):
l = [1, 2, 3, 4, 5, 6, 9]
assert l[0] == 1
More information about the pypy-commit
mailing list