mirror of
https://github.com/python/cpython.git
synced 2025-11-15 00:00:00 +00:00
Issue #29327: Fixed a crash when pass the iterable keyword argument to sorted().
This commit is contained in:
commit
299dc239fe
3 changed files with 15 additions and 1 deletions
|
|
@ -1627,6 +1627,16 @@ class TestSorted(unittest.TestCase):
|
|||
self.assertEqual(data, sorted(copy, reverse=1))
|
||||
self.assertNotEqual(data, copy)
|
||||
|
||||
def test_bad_arguments(self):
|
||||
# Issue #29327: The first argument is positional-only.
|
||||
sorted([])
|
||||
with self.assertRaises(TypeError):
|
||||
sorted(iterable=[])
|
||||
# Other arguments are keyword-only
|
||||
sorted([], key=None)
|
||||
with self.assertRaises(TypeError):
|
||||
sorted([], None)
|
||||
|
||||
def test_inputtypes(self):
|
||||
s = 'abracadabra'
|
||||
types = [list, tuple, str]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue