Skip to content

Commit b68510c

Browse files
GCI103 DictionaryItemsUnused update: add integrations/real tests
Co-authored-by: DataLabGroupe-CreditAgricole <[email protected]>
1 parent 0112353 commit b68510c

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2+
for a, b in my_dict.items():
3+
print(a, b)
4+
5+
for key, value in my_dict.items(): # Noncompliant {{Use dict.keys() or dict.values() instead of dict.items() when only one part of the key-value pair is used}}
6+
result.append(key)
7+
8+
for key, value in my_dict.items(): # Noncompliant {{Use dict.keys() or dict.values() instead of dict.items() when only one part of the key-value pair is used}}
9+
result.append(key)
10+
11+
12+
for key, value in my_dict.items(): # Noncompliant {{Use dict.keys() or dict.values() instead of dict.items() when only one part of the key-value pair is used}}
13+
result.append(value)
14+
15+
16+
for key in my_dict.keys():
17+
result.append(key)
18+
19+
20+
for value in my_dict.values():
21+
result.append(value)
22+
23+
24+
for item in my_dict.items():
25+
result.append(item)
26+
27+
28+
entries = []
29+
for k, v in my_dict.items():
30+
entries.append((k, v))
31+
32+
for key, value in my_dict.items(): # Noncompliant {{Use dict.keys() or dict.values() instead of dict.items() when only one part of the key-value pair is used}}
33+
do_something_with(key)
34+
35+
for k, v in my_dict.items(): # Noncompliant {{Use dict.keys() or dict.values() instead of dict.items() when only one part of the key-value pair is used}}
36+
do_something_with(v)
37+
38+
for key, value in my_dict.items():
39+
print(f"{key}: {value}")
40+
41+
for k, v in my_dict.items():
42+
some_list.append((k, v))
43+
44+
for k, v in my_dict.items(): # Noncompliant {{Use dict.keys() or dict.values() instead of dict.items() when only one part of the key-value pair is used}}
45+
used_keys.append(k)
46+
47+
if True:
48+
for k, v in my_dict.items():
49+
print(k)
50+
print(v)
51+
52+
copied_dict = dict(my_dict.items())
53+
54+
55+
for i, (k, v) in enumerate(my_dict.items()):
56+
print(i, k, v)
57+
58+
59+
{(k, v) for k, v in my_dict.items()}

0 commit comments

Comments
 (0)