diff options
Diffstat (limited to 'tests/functional/ext')
3 files changed, 14 insertions, 0 deletions
diff --git a/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.py b/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.py new file mode 100644 index 000000000..7b0e7c58d --- /dev/null +++ b/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.py @@ -0,0 +1,9 @@ +# pylint: disable=missing-docstring +from collections import namedtuple + +NoteHash = namedtuple('NoteHash', ['Pitch', 'Duration', 'Offset']) # [prefer-typing-namedtuple] + +class SearchMatch( + namedtuple('SearchMatch', ['els', 'index', 'iterator']) # [prefer-typing-namedtuple] +): + """Adapted from primer package `music21`.""" diff --git a/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.rc b/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.rc new file mode 100644 index 000000000..ee4eb7e68 --- /dev/null +++ b/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.rc @@ -0,0 +1,3 @@ +[MAIN] +load-plugins=pylint.extensions.code_style +enable=prefer-typing-namedtuple diff --git a/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.txt b/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.txt new file mode 100644 index 000000000..a9bf6751b --- /dev/null +++ b/tests/functional/ext/code_style/cs_prefer_typing_namedtuple.txt @@ -0,0 +1,2 @@ +prefer-typing-namedtuple:4:11:4:66::Prefer 'typing.NamedTuple' over 'collections.namedtuple':INFERENCE +prefer-typing-namedtuple:7:4:7:59:SearchMatch:Prefer 'typing.NamedTuple' over 'collections.namedtuple':INFERENCE |