[Python-checkins] gh-95173: Add a regression test for sorting tuples containing None (GH-95464)

miss-islington webhook-mailer at python.org
Mon Aug 1 12:30:08 EDT 2022


https://github.com/python/cpython/commit/76d83b1dfe4c7be04f51bbdb01f3b82df83f8958
commit: 76d83b1dfe4c7be04f51bbdb01f3b82df83f8958
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-08-01T09:29:57-07:00
summary:

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

(cherry picked from commit c0cd79021951b3ab10804d42b3963b9fb1a66be7)

Co-authored-by: Jacob Walls <jacobtylerwalls at gmail.com>

files:
M Lib/test/test_sort.py

diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
index 41de4b684f625..3b6ad4d17b041 100644
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -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__":



More information about the Python-checkins mailing list