[3.11] Add tests for empty range equality (GH-103751) (#103760)

(cherry picked from commit dca27a69a8)

Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2023-04-24 08:09:46 -07:00 committed by GitHub
parent 34df9e740d
commit 25406e5a35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -648,6 +648,11 @@ class RangeTest(unittest.TestCase):
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):