Skip to content

Commit

Permalink
gh-95173: Add a regression test for sorting tuples containing None (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls authored Aug 1, 2022
1 parent 7d89738 commit c0cd790
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/test/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ def test_not_all_tuples(self):
self.assertRaises(TypeError, [(1.0, 1.0), (False, "A"), 6].sort)
self.assertRaises(TypeError, [('a', 1), (1, 'a')].sort)
self.assertRaises(TypeError, [(1, 'a'), ('a', 1)].sort)

def test_none_in_tuples(self):
expected = [(None, 1), (None, 2)]
actual = sorted([(None, 2), (None, 1)])
self.assertEqual(actual, expected)

#==============================================================================

if __name__ == "__main__":
Expand Down

0 comments on commit c0cd790

Please sign in to comment.