diff options
Diffstat (limited to 'tests/functional/i/invalid_name.py')
-rw-r--r-- | tests/functional/i/invalid_name.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/functional/i/invalid_name.py b/tests/functional/i/invalid_name.py new file mode 100644 index 000000000..1a949904e --- /dev/null +++ b/tests/functional/i/invalid_name.py @@ -0,0 +1,39 @@ +""" Tests for invalid-name checker. """
+# pylint: disable=unused-import, no-absolute-import, wrong-import-position
+
+AAA = 24
+try:
+ import collections
+except ImportError:
+ collections = None
+
+aaa = 42 # [invalid-name]
+try:
+ import time
+except ValueError:
+ time = None # [invalid-name]
+
+try:
+ from sys import argv, executable as python
+except ImportError:
+ argv = 42
+ python = 24
+
+def test():
+ """ Shouldn't emit an invalid-name here. """
+ try:
+ import re
+ except ImportError:
+ re = None
+ return re
+
+def a(): # [invalid-name]
+ """yo"""
+
+
+def _generate_cmdline_tests():
+ TestCase = collections.namedtuple('TestCase', 'cmd, valid')
+ valid = ['leave-mode', 'hint all']
+ # Valid command only -> valid
+ for item in valid:
+ yield TestCase(''.join(item), True)
|