tests: Add a few tests for bool, bytearray, float to improve coverage.
This commit is contained in:
parent
a488c266c3
commit
1d350b8ac6
|
@ -9,3 +9,9 @@ print(False or True)
|
||||||
# unary operators
|
# unary operators
|
||||||
print(+True)
|
print(+True)
|
||||||
print(-True)
|
print(-True)
|
||||||
|
|
||||||
|
# unsupported unary op
|
||||||
|
try:
|
||||||
|
len(False)
|
||||||
|
except TypeError:
|
||||||
|
print('TypeError')
|
||||||
|
|
|
@ -27,4 +27,7 @@ print(bytearray([1]) == b"1")
|
||||||
print(b"1" == bytearray([1]))
|
print(b"1" == bytearray([1]))
|
||||||
print(bytearray() == bytearray())
|
print(bytearray() == bytearray())
|
||||||
|
|
||||||
|
# comparison with other type should return False
|
||||||
|
print(bytearray() == 1)
|
||||||
|
|
||||||
# TODO: other comparisons
|
# TODO: other comparisons
|
||||||
|
|
|
@ -12,3 +12,7 @@ print(b)
|
||||||
# extend
|
# extend
|
||||||
b.extend(bytearray(4))
|
b.extend(bytearray(4))
|
||||||
print(b)
|
print(b)
|
||||||
|
|
||||||
|
# this inplace add tests the code when the buffer doesn't need to be increased
|
||||||
|
b = bytearray()
|
||||||
|
b += b''
|
||||||
|
|
|
@ -25,3 +25,9 @@ for i in range(25):
|
||||||
for j in range(25):
|
for j in range(25):
|
||||||
y = (j - 12.5) / 6
|
y = (j - 12.5) / 6
|
||||||
test(x, y)
|
test(x, y)
|
||||||
|
|
||||||
|
# test division by zero error
|
||||||
|
try:
|
||||||
|
divmod(1.0, 0)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
print('ZeroDivisionError')
|
||||||
|
|
Loading…
Reference in New Issue