mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Issue #16402: Merge fix from 3.2
This commit is contained in:
commit
1321edaa55
3 changed files with 17 additions and 5 deletions
|
@ -312,6 +312,15 @@ class RangeTest(unittest.TestCase):
|
|||
|
||||
self.assertRaises(TypeError, range, IN())
|
||||
|
||||
# Test use of user-defined classes in slice indices.
|
||||
self.assertEqual(list(range(10)[:I(5)]), list(range(5)))
|
||||
|
||||
with self.assertRaises(RuntimeError):
|
||||
range(0, 10)[:IX()]
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
range(0, 10)[:IN()]
|
||||
|
||||
def test_count(self):
|
||||
self.assertEqual(range(3).count(-1), 0)
|
||||
self.assertEqual(range(3).count(0), 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue