Issue #929 - out-of-range integer values shouldn't be accepted
()
| 225 | |
| 226 | |
| 227 | def test_integer_casting(): |
| 228 | """Issue #929 - out-of-range integer values shouldn't be accepted""" |
| 229 | assert m.i32_str(-1) == "-1" |
| 230 | assert m.i64_str(-1) == "-1" |
| 231 | assert m.i32_str(2000000000) == "2000000000" |
| 232 | assert m.u32_str(2000000000) == "2000000000" |
| 233 | assert m.i64_str(-999999999999) == "-999999999999" |
| 234 | assert m.u64_str(999999999999) == "999999999999" |
| 235 | |
| 236 | with pytest.raises(TypeError) as excinfo: |
| 237 | m.u32_str(-1) |
| 238 | assert "incompatible function arguments" in str(excinfo.value) |
| 239 | with pytest.raises(TypeError) as excinfo: |
| 240 | m.u64_str(-1) |
| 241 | assert "incompatible function arguments" in str(excinfo.value) |
| 242 | with pytest.raises(TypeError) as excinfo: |
| 243 | m.i32_str(-3000000000) |
| 244 | assert "incompatible function arguments" in str(excinfo.value) |
| 245 | with pytest.raises(TypeError) as excinfo: |
| 246 | m.i32_str(3000000000) |
| 247 | assert "incompatible function arguments" in str(excinfo.value) |
| 248 | |
| 249 | |
| 250 | def test_int_convert(doc): |