From dca27a69a8261353f7f986eb8f808f0d487ac4b7 Mon Sep 17 00:00:00 2001 From: Kirill <80244920+Eclips4@users.noreply.github.com> Date: Mon, 24 Apr 2023 17:32:15 +0300 Subject: [PATCH] Add tests for empty range equality (#103751) --- Lib/test/test_range.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/test/test_range.py b/Lib/test/test_range.py index 3870b153688b25..4a6431e10f1842 100644 --- a/Lib/test/test_range.py +++ b/Lib/test/test_range.py @@ -677,6 +677,11 @@ def test_comparison(self): hash(range(2**200, 2**201, 2**100))) self.assertNotEqual(range(2**200, 2**201, 2**100), range(2**200, 2**201 + 1, 2**100)) + # Empty ranges + self.assertEqual(range(32, 16), range(0)) + self.assertEqual(hash(range(32, 16)), hash(range(0))) + self.assertEqual(range(2, 1, 3), range(0)) + self.assertEqual(hash(range(2, 1, 3)), hash(range(0))) # Order comparisons are not implemented for ranges. with self.assertRaises(TypeError):