summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sort.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-08-01 16:29:57 (GMT)
committerGitHub <noreply@github.com>2022-08-01 16:29:57 (GMT)
commit76d83b1dfe4c7be04f51bbdb01f3b82df83f8958 (patch)
tree64ee1d8674f63ac387759cc18e59e5b2b29bf980 /Lib/test/test_sort.py
parent3192fd7683ad979d7f5ba996801da474c1606786 (diff)
downloadcpython-76d83b1dfe4c7be04f51bbdb01f3b82df83f8958.zip
cpython-76d83b1dfe4c7be04f51bbdb01f3b82df83f8958.tar.gz
cpython-76d83b1dfe4c7be04f51bbdb01f3b82df83f8958.tar.bz2
gh-95173: Add a regression test for sorting tuples containing None (GH-95464)
(cherry picked from commit c0cd79021951b3ab10804d42b3963b9fb1a66be7) Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Diffstat (limited to 'Lib/test/test_sort.py')
-rw-r--r--Lib/test/test_sort.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_sort.py b/Lib/test/test_sort.py
index 41de4b6..3b6ad4d 100644
--- a/Lib/test/test_sort.py
+++ b/Lib/test/test_sort.py
@@ -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__":