diff options
Diffstat (limited to 'tests/basics/int_bytes.py')
| -rw-r--r-- | tests/basics/int_bytes.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/basics/int_bytes.py b/tests/basics/int_bytes.py index 059c16d3f..8c0c9a82f 100644 --- a/tests/basics/int_bytes.py +++ b/tests/basics/int_bytes.py @@ -17,3 +17,15 @@ try: (1).to_bytes(-1, "little") except ValueError: print("ValueError") + +# too small buffer should raise an error +try: + (256).to_bytes(1, "little") +except OverflowError: + print("OverflowError") + +# negative numbers should raise an error +try: + (-256).to_bytes(2, "little") +except OverflowError: + print("OverflowError") |
