]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-95173: Add a regression test for sorting tuples containing None (#95464)
authorJacob Walls <jacobtylerwalls@gmail.com>
Mon, 1 Aug 2022 16:02:09 +0000 (12:02 -0400)
committerGitHub <noreply@github.com>
Mon, 1 Aug 2022 16:02:09 +0000 (18:02 +0200)
Lib/test/test_sort.py

index 41de4b684f62513e1e30f4ef59e99f5f8405981d..3b6ad4d17b0416a084eae686e0d3dfc619facc47 100644 (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__":