summaryrefslogtreecommitdiff
path: root/tests/basics/bytes_construct.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/bytes_construct.py')
-rw-r--r--tests/basics/bytes_construct.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/bytes_construct.py b/tests/basics/bytes_construct.py
index e43c8179f..59e02f063 100644
--- a/tests/basics/bytes_construct.py
+++ b/tests/basics/bytes_construct.py
@@ -14,6 +14,18 @@ print(bytes(array('h', [0x101, 0x202])))
# long ints
print(ord(bytes([14953042807679334000 & 0xff])))
+# constructor value out of range
+try:
+ bytes([-1])
+except ValueError:
+ print('ValueError')
+
+# constructor value out of range
+try:
+ bytes([256])
+except ValueError:
+ print('ValueError')
+
# error in construction
try:
a = bytes([1, 2, 3], 1)