tests: Add a few tests for bool, bytearray, float to improve coverage.

This commit is contained in:
Damien George 2015-08-25 18:18:57 +01:00
parent a488c266c3
commit 1d350b8ac6
4 changed files with 19 additions and 0 deletions

View File

@ -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')

View File

@ -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

View File

@ -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''

View File

@ -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')