Commit 72406635 authored by Damien George's avatar Damien George

leon: Add some more Spacebel tests: 883, 1593, 1603.

parent b6d5283b
# unpack allows input buffer to be longer than needed
import ustruct as struct
s = struct.pack('ii', 1, 2)
try:
print(struct.unpack('i', s))
except:
print('Exception')
Exception
Exception
Exception
Exception
Exception
Exception
# negative args to bytes/bytearray
try:
bytes(-1)
except:
print('Exception')
try:
bytes(-2)
except:
print('Exception')
try:
bytes(-3)
except:
print('Exception')
try:
bytearray(-1)
except:
print('Exception')
try:
bytearray(-2)
except:
print('Exception')
try:
bytearray(-3)
except:
print('Exception')
True
False
True
True
True
True
True
True
True
True
True
False
TypeError
# test binary operations on range objects; (in)equality only
# basic (in)equality
print(range(1) == range(1))
print(range(1) != range(1))
print(range(1) != range(2))
# empty range
print(range(0) == range(0))
print(range(1, 0) == range(0))
print(range(1, 4, -1) == range(6, 3))
# 1 element range
print(range(1, 4, 10) == range(1, 4, 10))
print(range(1, 4, 10) == range(1, 4, 20))
print(range(1, 4, 10) == range(1, 8, 20))
# more than 1 element
print(range(0, 3, 2) == range(0, 3, 2))
print(range(0, 3, 2) == range(0, 4, 2))
print(range(0, 3, 2) == range(0, 5, 2))
# unsupported binary op
try:
range(1) + 10
except TypeError:
print('TypeError')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment