diff options
author | Damien George <damien.p.george@gmail.com> | 2015-09-03 23:06:18 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-09-03 23:06:18 +0100 |
commit | 25afc7da0db43754f6b4373a10b66551dd3cbd57 (patch) | |
tree | e2e116af73a03aaf6e11b4b0065e5f73eb6a91af /tests/basics/bytes_construct.py | |
parent | e2aa1177986d11cbd19ab84ca41b6f0dce51ad01 (diff) |
tests: Add tests to improve coverage of objstr.c.
Diffstat (limited to 'tests/basics/bytes_construct.py')
-rw-r--r-- | tests/basics/bytes_construct.py | 12 |
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) |