Skip to content

Commit 1d350b8

Browse files
committed
tests: Add a few tests for bool, bytearray, float to improve coverage.
1 parent a488c26 commit 1d350b8

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

tests/basics/bool1.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
# unary operators
1010
print(+True)
1111
print(-True)
12+
13+
# unsupported unary op
14+
try:
15+
len(False)
16+
except TypeError:
17+
print('TypeError')

tests/basics/bytearray1.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@
2727
print(b"1" == bytearray([1]))
2828
print(bytearray() == bytearray())
2929

30+
# comparison with other type should return False
31+
print(bytearray() == 1)
32+
3033
# TODO: other comparisons

tests/basics/bytearray_add.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@
1212
# extend
1313
b.extend(bytearray(4))
1414
print(b)
15+
16+
# this inplace add tests the code when the buffer doesn't need to be increased
17+
b = bytearray()
18+
b += b''

tests/float/float_divmod_relaxed.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ def test(x, y):
2525
for j in range(25):
2626
y = (j - 12.5) / 6
2727
test(x, y)
28+
29+
# test division by zero error
30+
try:
31+
divmod(1.0, 0)
32+
except ZeroDivisionError:
33+
print('ZeroDivisionError')

0 commit comments

Comments
 (0)