The following issues were found
tests/basics/dict_update.py
1 issues
Line: 1
Column: 1
d = {1:2, 3:4}
print(len(d))
d.update(["ab"])
print(d[1])
print(d[3])
print(d["a"])
print(len(d))
d.update([(1,4)])
print(d[1])
Reported by Pylint.
tests/basics/bytearray_add.py
1 issues
Line: 1
Column: 1
# test bytearray + bytearray
b = bytearray(2)
b[0] = 1
b[1] = 2
print(b + bytearray(2))
# inplace add
b += bytearray(3)
Reported by Pylint.
tests/basics/dict_specialmeth.py
1 issues
Line: 1
Column: 1
# dict object with special methods
d = {}
d.__setitem__('2', 'two')
print(d.__getitem__('2'))
d.__delitem__('2')
print(d)
Reported by Pylint.
tests/basics/builtin_sum.py
1 issues
Line: 1
Column: 1
# test builtin "sum"
tests = (
(),
[],
[0],
[1],
[0, 1, 2],
range(10),
Reported by Pylint.
tests/basics/dict_pop.py
1 issues
Line: 1
Column: 1
d = {1: 2, 3: 4}
print(d.pop(3), d)
print(d)
print(d.pop(1, 42), d)
print(d.pop(1, 42), d)
print(d.pop(1, None), d)
try:
print(d.pop(1), "!!!")
except KeyError:
Reported by Pylint.
tests/basics/dict_iterator.py
1 issues
Line: 1
Column: 1
d = {1: 2, 3: 4}
els = []
for i in d:
els.append((i, d[i]))
print(sorted(els))
Reported by Pylint.
tests/basics/dict_get.py
1 issues
Line: 1
Column: 1
for d in {}, {42:2}:
print(d.get(42))
print(d.get(42,2))
Reported by Pylint.
tests/stress/dict_copy.py
1 issues
Line: 1
Column: 1
# copying a large dictionary
a = {i: 2 * i for i in range(1000)}
b = a.copy()
for i in range(1000):
print(i, b[i])
print(len(b))
Reported by Pylint.
tests/stress/dict_create_max.py
1 issues
Line: 1
Column: 1
# The aim with this test is to hit the maximum resize/rehash size of a dict,
# where there are no more primes in the table of growing allocation sizes.
# This value is 54907 items.
d = {}
try:
for i in range(54908):
d[i] = i
except MemoryError:
Reported by Pylint.
tests/stress/list_sort.py
1 issues
Line: 1
Column: 1
# test large list sorting (should not stack overflow)
l = list(range(2000))
l.sort()
print(l[0], l[-1])
l.sort(reverse=True)
print(l[0], l[-1])
Reported by Pylint.