The following issues were found
tests/basics/int_divmod.py
1 issues
Line: 1
Column: 1
# test integer floor division and modulo
# test all combination of +/-/0 cases
for i in range(-2, 3):
for j in range(-4, 5):
if j != 0:
print(i, j, i // j, i % j, divmod(i, j))
Reported by Pylint.
tests/basics/int_constfolding_intbig.py
1 issues
Line: 1
Column: 1
# tests int constant folding in compiler
# negation
print(-0x3fffffff) # 32-bit edge case
print(-0x3fffffffffffffff) # 64-bit edge case
print(-(-0x3fffffff - 1)) # 32-bit edge case
print(-(-0x3fffffffffffffff - 1)) # 64-bit edge case
# 1's complement
Reported by Pylint.
tests/basics/int_bytes_intbig.py
1 issues
Line: 1
Column: 1
print((2**64).to_bytes(9, "little"))
print((2**64).to_bytes(9, "big"))
b = bytes(range(20))
il = int.from_bytes(b, "little")
ib = int.from_bytes(b, "big")
print(il)
print(ib)
Reported by Pylint.
tests/basics/int_bytes.py
1 issues
Line: 1
Column: 1
print((10).to_bytes(1, "little"))
print((111111).to_bytes(4, "little"))
print((100).to_bytes(10, "little"))
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
print(int.from_bytes(b"\x01\0\0\0\0\0\0\0", "little"))
print(int.from_bytes(b"\x00\x01\0\0\0\0\0\0", "little"))
# check that extra zero bytes don't change the internal int value
print(int.from_bytes(bytes(20), "little") == 0)
Reported by Pylint.
tests/basics/int_big_unary.py
1 issues
Line: 1
Column: 1
# test bignum unary operations
i = 1 << 65
print(bool(i))
print(+i)
print(-i)
print(~i)
Reported by Pylint.
tests/basics/int_big_rshift.py
1 issues
Line: 1
Column: 1
i = 123456789012345678901234567890
print(i >> 1)
print(i >> 1000)
# result needs rounding up
i = -(1 << 70)
print(i >> 80)
i = -0xffffffffffffffff
print(i >> 32)
Reported by Pylint.
tests/basics/int_big_pow.py
1 issues
Line: 1
Column: 1
# test bignum power
i = 1 << 65
print(0 ** i)
print(i ** 0)
print(i ** 1)
print(i ** 2)
Reported by Pylint.
tools/mpy_bin2res.py
1 issues
Line: 1
Column: 1
#!/usr/bin/env python3
#
# This tool converts binary resource files passed on the command line
# into a Python source file containing data from these files, which can
# be accessed using standard pkg_resources.resource_stream() function
# from micropython-lib:
# https://github.com/micropython/micropython-lib/tree/master/pkg_resources
#
import sys
Reported by Pylint.
tests/basics/int_big_lshift.py
1 issues
Line: 1
Column: 1
# tests transition from small to large int representation by left-shift operation
for i in range(1, 17):
for shift in range(70):
print(i, '<<', shift, '=', i << shift)
# test bit-shifting negative integers
for i in range(8):
print(-100000000000000000000000000000 << i)
print(-100000000000000000000000000001 << i)
Reported by Pylint.
tests/basics/builtin_oct_intbig.py
1 issues
Line: 1
Column: 1
# test builtin oct function
print(oct(12345678901234567890))
print(oct(0o12345670123456701234))
Reported by Pylint.