Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
34ba06b0
Commit
34ba06b0
authored
Apr 07, 2014
by
Damien George
Browse files
Merge pull request #444 from lurch/test-sorted
Add tests for sorted() function
parents
2bfd2dc7
a1a9ab2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/basics/list_sort.py
View file @
34ba06b0
l
=
[
1
,
3
,
2
,
5
]
print
(
l
)
print
(
sorted
(
l
))
l
.
sort
()
print
(
l
)
print
(
l
==
sorted
(
l
))
print
(
sorted
(
l
,
key
=
lambda
x
:
-
x
))
l
.
sort
(
key
=
lambda
x
:
-
x
)
print
(
l
)
print
(
l
==
sorted
(
l
,
key
=
lambda
x
:
-
x
))
print
(
sorted
(
l
,
key
=
lambda
x
:
-
x
,
reverse
=
True
))
l
.
sort
(
key
=
lambda
x
:
-
x
,
reverse
=
True
)
print
(
l
)
print
(
l
==
sorted
(
l
,
key
=
lambda
x
:
-
x
,
reverse
=
True
))
print
(
sorted
(
l
,
reverse
=
True
))
l
.
sort
(
reverse
=
True
)
print
(
l
)
print
(
l
==
sorted
(
l
,
reverse
=
True
))
print
(
sorted
(
l
,
reverse
=
False
))
l
.
sort
(
reverse
=
False
)
print
(
l
)
print
(
l
==
sorted
(
l
,
reverse
=
False
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment