Skip to content

Commit 8fa2f09

Browse files
Eclips4miss-islington
authored andcommitted
Add tests for empty range equality (pythonGH-103751)
(cherry picked from commit dca27a6) Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com>
1 parent 34df9e7 commit 8fa2f09

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_range.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,11 @@ def test_comparison(self):
648648
hash(range(2**200, 2**201, 2**100)))
649649
self.assertNotEqual(range(2**200, 2**201, 2**100),
650650
range(2**200, 2**201 + 1, 2**100))
651+
# Empty ranges
652+
self.assertEqual(range(32, 16), range(0))
653+
self.assertEqual(hash(range(32, 16)), hash(range(0)))
654+
self.assertEqual(range(2, 1, 3), range(0))
655+
self.assertEqual(hash(range(2, 1, 3)), hash(range(0)))
651656

652657
# Order comparisons are not implemented for ranges.
653658
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy