mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Add tests for empty range equality (#103751)
This commit is contained in:
parent
543009347e
commit
dca27a69a8
1 changed files with 5 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue