From 1d350b8ac6c65bd53115bfdc7511e4028f3c69ac Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Tue, 25 Aug 2015 18:18:57 +0100
Subject: [PATCH] tests: Add a few tests for bool, bytearray, float to improve
 coverage.

---
 tests/basics/bool1.py               | 6 ++++++
 tests/basics/bytearray1.py          | 3 +++
 tests/basics/bytearray_add.py       | 4 ++++
 tests/float/float_divmod_relaxed.py | 6 ++++++
 4 files changed, 19 insertions(+)

diff --git a/tests/basics/bool1.py b/tests/basics/bool1.py
index 99bd83792..35d9ed8cc 100644
--- a/tests/basics/bool1.py
+++ b/tests/basics/bool1.py
@@ -9,3 +9,9 @@ print(False or True)
 # unary operators
 print(+True)
 print(-True)
+
+# unsupported unary op
+try:
+    len(False)
+except TypeError:
+    print('TypeError')
diff --git a/tests/basics/bytearray1.py b/tests/basics/bytearray1.py
index 76e7e5975..2e47f17bf 100644
--- a/tests/basics/bytearray1.py
+++ b/tests/basics/bytearray1.py
@@ -27,4 +27,7 @@ print(bytearray([1]) == b"1")
 print(b"1" == bytearray([1]))
 print(bytearray() == bytearray())
 
+# comparison with other type should return False
+print(bytearray() == 1)
+
 # TODO: other comparisons
diff --git a/tests/basics/bytearray_add.py b/tests/basics/bytearray_add.py
index 21a386c6e..a7e2b5737 100644
--- a/tests/basics/bytearray_add.py
+++ b/tests/basics/bytearray_add.py
@@ -12,3 +12,7 @@ print(b)
 # extend
 b.extend(bytearray(4))
 print(b)
+
+# this inplace add tests the code when the buffer doesn't need to be increased
+b = bytearray()
+b += b''
diff --git a/tests/float/float_divmod_relaxed.py b/tests/float/float_divmod_relaxed.py
index 7054d2ca6..a9450fa2c 100644
--- a/tests/float/float_divmod_relaxed.py
+++ b/tests/float/float_divmod_relaxed.py
@@ -25,3 +25,9 @@ for i in range(25):
     for j in range(25):
         y = (j - 12.5) / 6
         test(x, y)
+
+# test division by zero error
+try:
+    divmod(1.0, 0)
+except ZeroDivisionError:
+    print('ZeroDivisionError')
-- 
GitLab