gh-95173: Add a regression test for sorting tuples containing None (#95464)

This commit is contained in:
Jacob Walls 2022-08-01 12:02:09 -04:00 committed by GitHub
parent 7d8973870b
commit c0cd790219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -378,6 +378,12 @@ class TestOptimizedCompares(unittest.TestCase):
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__":