Skip to content

Commit 71eaf55

Browse files
committed
Add test for sorted with list subclass
1 parent 4b106fe commit 71eaf55

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_sorted.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ def test_inputtypes(self):
3737
def test_baddecorator(self):
3838
data = 'The quick Brown fox Jumped over The lazy Dog'.split()
3939
self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0)
40+
41+
def test_list_subclass(self):
42+
class MyList(list):
43+
def __iter__(self):
44+
return iter([4, 2, 5])
45+
46+
# Use eval to get the fast path specialization
47+
self.assertEqual(eval("sorted(MyList())", {"MyList": MyList}), [2, 4, 5])

0 commit comments

Comments
 (0)