Skip to content

Commit 4ba4d9e

Browse files
committed
Add functional test
1 parent a18abcc commit 4ba4d9e

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

pylint/extensions/dictionary_subscript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class NoDictSubscriptChecker(BaseChecker):
1414
name = "no-dict-subscript"
1515
msgs = {
1616
"R5701": (
17-
"Uses dict operator []",
17+
"Using dict operator [], consider using get() instead",
1818
"dict-subscript",
1919
"Used to warn when subscripting a dictionary instead of using the get() function",
2020
),
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""Checks the use of dictionary subscripts"""
2+
3+
mydict = {"foo": 3}
4+
5+
print(mydict["foo"])
6+
print(mydict.get("foo"))
7+
8+
mydict["foo"] = 4
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[MAIN]
2+
load-plugins=pylint.extensions.dictionary_subscript,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dict-subscript:5:6:5:19::"Using dict operator [], consider using get() instead":UNDEFINED

0 commit comments

Comments
 (0)