Skip to content

Commit cf32df7

Browse files
committed
new try
1 parent d31767d commit cf32df7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

builtin/tests/sorting.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Use of this source code is governed by a BSD-style
33
# license that can be found in the LICENSE file.
44

5+
doc = "sort: order"
56
l = []
67
l2 = sorted(l)
78
assert l == l2
@@ -10,15 +11,21 @@
1011
a = [5, 2, 3, 1, 4]
1112
assert a.sort() == None
1213
assert a == [1, 2, 3, 4, 5]
14+
15+
doc = "sort: dict-type as iterable"
1316
assert sorted({"1": "D", "2": "B", "3": "B", "5": "E", "4": "A"}) == ["1", "2", "3", "4", "5"]
1417

18+
19+
doc = "sort: complex arguments"
1520
kwargs = {"key": lambda l: l&1+l, "reverse": True}
1621
l = list(range(10))
1722
l.sort(**kwargs)
1823
assert l == sorted(range(10), **kwargs) == [8, 9, 6, 4, 5, 2, 0, 1, 3, 7]
1924

25+
doc = "sort: different types that are comparable"
2026
assert sorted([1, 2, 1.1], reverse=1) == [2, 1.1, 1]
2127

28+
doc = "sort: call syntax and types"
2229
try:
2330
sorted()
2431
except TypeError:
@@ -52,4 +59,6 @@
5259
except TypeError:
5360
pass
5461
else:
55-
assert False
62+
assert False
63+
64+
doc = "finished"

0 commit comments

Comments
 (0)