Skip to content

Commit

Permalink
Add tests for empty range equality (python#103751)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eclips4 committed Apr 24, 2023
1 parent 5430093 commit dca27a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/test/test_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit dca27a6

Please sign in to comment.