tests/basics: Add tests for raising ValueError when range() gets 0 step.
This commit is contained in:
parent
de9b53695d
commit
dcd8f52766
@ -34,6 +34,12 @@ print(range(1, 4)[1:])
|
||||
print(range(1, 4)[:-1])
|
||||
print(range(7, -2, -4)[:])
|
||||
|
||||
# zero step
|
||||
try:
|
||||
range(1, 2, 0)
|
||||
except ValueError:
|
||||
print("ValueError")
|
||||
|
||||
# bad unary op
|
||||
try:
|
||||
-range(1)
|
||||
|
@ -6,6 +6,13 @@ for x in range(*(1, 3)):
|
||||
for x in range(1, *(6, 2)):
|
||||
print(x)
|
||||
|
||||
# zero step
|
||||
try:
|
||||
for x in range(1, 2, 0):
|
||||
pass
|
||||
except ValueError:
|
||||
print('ValueError')
|
||||
|
||||
# apply args using **
|
||||
try:
|
||||
for x in range(**{'end':1}):
|
||||
|
Loading…
Reference in New Issue
Block a user