summaryrefslogtreecommitdiff
path: root/tests/input
diff options
context:
space:
mode:
authorAshley Whetter <ashley@awhetter.co.uk>2019-06-14 22:28:42 -0700
committerClaudiu Popa <pcmanticore@gmail.com>2019-06-20 10:02:14 +0200
commit33b8185a455c1686d038258697bb93005f2441c2 (patch)
tree4a50ccac775c009436e45803129e428ed694065f /tests/input
parent7081d91f30728653000bdfc59ea85a3395f96418 (diff)
downloadpylint-git-33b8185a455c1686d038258697bb93005f2441c2.tar.gz
Stopped installing tests with package
Diffstat (limited to 'tests/input')
-rw-r--r--tests/input/__init__.py1
-rw-r--r--tests/input/func_3k_removed_stuff_py_30.py13
-rw-r--r--tests/input/func_bad_cont_dictcomp_py27.py38
-rw-r--r--tests/input/func_bug113231.py24
-rw-r--r--tests/input/func_disable_linebased.py14
-rw-r--r--tests/input/func_dotted_ancestor.py11
-rw-r--r--tests/input/func_e0012.py4
-rw-r--r--tests/input/func_e0204.py20
-rw-r--r--tests/input/func_e12xx.py28
-rw-r--r--tests/input/func_e13xx.py21
-rw-r--r--tests/input/func_excess_escapes.py30
-rw-r--r--tests/input/func_first_arg.py42
-rw-r--r--tests/input/func_i0011.py4
-rw-r--r--tests/input/func_i0012.py4
-rw-r--r--tests/input/func_i0013.py8
-rw-r--r--tests/input/func_i0014.py8
-rw-r--r--tests/input/func_i0020.py8
-rw-r--r--tests/input/func_i0022.py22
-rw-r--r--tests/input/func_logging_not_lazy_with_logger.py13
-rw-r--r--tests/input/func_loopvar_in_dict_comp_py27.py8
-rw-r--r--tests/input/func_module___dict__.py9
-rw-r--r--tests/input/func_nameerror_on_string_substitution.py8
-rw-r--r--tests/input/func_no_dummy_redefined.py14
-rw-r--r--tests/input/func_noerror___init___return_from_inner_function.py12
-rw-r--r--tests/input/func_noerror_access_attr_before_def_false_positive.py98
-rw-r--r--tests/input/func_noerror_base_init_vars.py35
-rw-r--r--tests/input/func_noerror_builtin_module_test.py11
-rw-r--r--tests/input/func_noerror_class_attributes.py18
-rw-r--r--tests/input/func_noerror_classes_meth_could_be_a_function.py33
-rw-r--r--tests/input/func_noerror_classes_protected_member_access.py26
-rw-r--r--tests/input/func_noerror_decorator_scope.py19
-rw-r--r--tests/input/func_noerror_e1101_9588_base_attr_aug_assign.py38
-rw-r--r--tests/input/func_noerror_external_classmethod_crash.py21
-rw-r--r--tests/input/func_noerror_inner_classes.py33
-rw-r--r--tests/input/func_noerror_lambda_use_before_assign.py8
-rw-r--r--tests/input/func_noerror_mcs_attr_access.py20
-rw-r--r--tests/input/func_noerror_new_style_class_py_30.py45
-rw-r--r--tests/input/func_noerror_no_warning_docstring.py42
-rw-r--r--tests/input/func_noerror_object_as_class_attribute.py18
-rw-r--r--tests/input/func_noerror_overloaded_operator.py21
-rw-r--r--tests/input/func_noerror_property_affectation_py26.py24
-rw-r--r--tests/input/func_noerror_yield_assign_py25.py21
-rw-r--r--tests/input/func_noerror_yield_return_mix.py8
-rw-r--r--tests/input/func_nonregr___file___global.py8
-rw-r--r--tests/input/func_return_yield_mix_py_33.py15
-rw-r--r--tests/input/func_typecheck_callfunc_assigment.py61
-rw-r--r--tests/input/func_unused_import_py30.py20
-rw-r--r--tests/input/func_variables_unused_name_from_wilcard_import.py3
-rw-r--r--tests/input/func_w0122_py_30.py12
-rw-r--r--tests/input/func_w0233.py51
-rw-r--r--tests/input/func_w0332_py_30.py4
-rw-r--r--tests/input/func_w0401.py9
-rw-r--r--tests/input/func_w0401_disabled.py9
-rw-r--r--tests/input/func_w0401_disabled_in_func.py11
-rw-r--r--tests/input/func_w0401_package/__init__.py2
-rw-r--r--tests/input/func_w0401_package/all_the_things.py9
-rw-r--r--tests/input/func_w0401_package/thing1.py3
-rw-r--r--tests/input/func_w0401_package/thing2.py7
-rw-r--r--tests/input/func_w0404.py27
-rw-r--r--tests/input/func_w0405.py31
-rw-r--r--tests/input/func_w0406.py10
-rw-r--r--tests/input/func_w0611.py25
-rw-r--r--tests/input/func_w0612.py37
-rw-r--r--tests/input/func_w0613.py42
-rw-r--r--tests/input/func_w0623_py30.py17
-rw-r--r--tests/input/func_w0801.py11
-rw-r--r--tests/input/hide_code_with_imports.py16
-rw-r--r--tests/input/ignore_except_pass_by_default.py6
-rw-r--r--tests/input/multiline-import8
-rw-r--r--tests/input/noext4
-rw-r--r--tests/input/not__init__.py1
-rw-r--r--tests/input/similar130
-rw-r--r--tests/input/similar230
-rw-r--r--tests/input/w0401_cycle.py9
-rw-r--r--tests/input/w0801_same.py11
75 files changed, 1442 insertions, 0 deletions
diff --git a/tests/input/__init__.py b/tests/input/__init__.py
new file mode 100644
index 000000000..60e92b76c
--- /dev/null
+++ b/tests/input/__init__.py
@@ -0,0 +1 @@
+"""test"""
diff --git a/tests/input/func_3k_removed_stuff_py_30.py b/tests/input/func_3k_removed_stuff_py_30.py
new file mode 100644
index 000000000..54ad935bc
--- /dev/null
+++ b/tests/input/func_3k_removed_stuff_py_30.py
@@ -0,0 +1,13 @@
+"""test relative import"""
+# pylint: disable=no-absolute-import
+from __future__ import print_function
+import func_w0401
+__revision__ = filter(None, map(str, (1, 2, 3)))
+
+
+def function():
+ """something"""
+ print(func_w0401)
+ unic = u"unicode"
+ low = unic.looower
+ return low
diff --git a/tests/input/func_bad_cont_dictcomp_py27.py b/tests/input/func_bad_cont_dictcomp_py27.py
new file mode 100644
index 000000000..a55271079
--- /dev/null
+++ b/tests/input/func_bad_cont_dictcomp_py27.py
@@ -0,0 +1,38 @@
+"""Bad continuations in dictionary comprehensions."""
+
+__revision__ = 0
+
+# Dictionary comprehensions should not require extra indentation when breaking
+# before the 'for', which is not part of the value
+C1 = {'key{}'.format(x): 'value{}'.format(x)
+ for x in range(3)}
+
+C2 = {'key{}'.format(x): 'value{}'.format(x) for x in
+ range(3)}
+
+# Dictionary comprehensions with multiple loops broken in different places
+C3 = {x*y: (x, y) for x in range(3) for y in range(3)}
+
+C4 = {x*y: (x, y)
+ for x in range(3) for y in range(3)}
+
+C5 = {x*y: (x, y) for x
+ in range(3) for y in range(3)}
+
+C6 = {x*y: (x, y) for x in range(3)
+ for y in range(3)}
+
+C7 = {key:
+ key ** 2
+ for key in range(10)}
+
+C8 = {
+ key: key ** 2
+ for key in range(10)}
+
+# Misaligned cases for dict comprehensions
+C9 = {'key{}'.format(x): 'value{}'.format(x)
+ for x in range(3)} # [bad-continuation]
+
+C9 = {'key{}'.format(x): 'value{}'.format(x)
+ for x in range(3)} # [bad-continuation]
diff --git a/tests/input/func_bug113231.py b/tests/input/func_bug113231.py
new file mode 100644
index 000000000..6334ff9c8
--- /dev/null
+++ b/tests/input/func_bug113231.py
@@ -0,0 +1,24 @@
+# pylint: disable=E1101
+# pylint: disable=C0103
+# pylint: disable=R0903, useless-object-inheritance, unnecessary-pass
+"""test bugfix for #113231 in logging checker
+"""
+from __future__ import absolute_import
+# Muck up the names in an effort to confuse...
+import logging as renamed_logging
+
+__revision__ = ''
+
+class Logger(object):
+ """Fake logger"""
+ pass
+
+logger = renamed_logging.getLogger(__name__)
+fake_logger = Logger()
+
+# Statements that should be flagged:
+renamed_logging.warning('%s, %s' % (4, 5))
+logger.warning('%s' % 5)
+
+# Statements that should not be flagged:
+fake_logger.warn('%s' % 5)
diff --git a/tests/input/func_disable_linebased.py b/tests/input/func_disable_linebased.py
new file mode 100644
index 000000000..b94c2e315
--- /dev/null
+++ b/tests/input/func_disable_linebased.py
@@ -0,0 +1,14 @@
+# This is a very very very very very very very very very very very very very very very very very very very very very long line.
+# pylint: disable=line-too-long
+"""Make sure enable/disable pragmas work for messages that are applied to lines and not syntax nodes.
+
+A disable pragma for a message that applies to nodes is applied to the whole
+block if it comes before the first statement (excluding the docstring). For
+line-based messages, this behavior needs to be altered to really only apply to
+the enclosed lines.
+"""
+# pylint: enable=line-too-long
+
+from __future__ import print_function
+
+print('This is a very long line which the linter will warn about, now that line-too-long has been enabled again.')
diff --git a/tests/input/func_dotted_ancestor.py b/tests/input/func_dotted_ancestor.py
new file mode 100644
index 000000000..ff3285803
--- /dev/null
+++ b/tests/input/func_dotted_ancestor.py
@@ -0,0 +1,11 @@
+"""bla"""
+# pylint: disable=no-absolute-import
+
+from input import func_w0233
+
+__revision__ = 'yo'
+
+class Aaaa(func_w0233.AAAA):
+ """test dotted name in ancestors"""
+ def __init__(self):
+ func_w0233.AAAA.__init__(self)
diff --git a/tests/input/func_e0012.py b/tests/input/func_e0012.py
new file mode 100644
index 000000000..f4810ee7a
--- /dev/null
+++ b/tests/input/func_e0012.py
@@ -0,0 +1,4 @@
+# pylint:enable=W04044
+"""check unknown option
+"""
+__revision__ = 1
diff --git a/tests/input/func_e0204.py b/tests/input/func_e0204.py
new file mode 100644
index 000000000..9a0f708f0
--- /dev/null
+++ b/tests/input/func_e0204.py
@@ -0,0 +1,20 @@
+"""check for method without self as first argument
+"""
+# pylint: disable=useless-object-inheritance
+from __future__ import print_function
+__revision__ = 0
+
+
+class Abcd(object):
+ """dummy class"""
+
+ def __init__(truc):
+ """method without self"""
+ print(1)
+
+ def abdc(yoo):
+ """another test"""
+ print(yoo)
+ def edf(self):
+ """just another method"""
+ print('yapudju in', self)
diff --git a/tests/input/func_e12xx.py b/tests/input/func_e12xx.py
new file mode 100644
index 000000000..74984d998
--- /dev/null
+++ b/tests/input/func_e12xx.py
@@ -0,0 +1,28 @@
+# pylint: disable=E1101, no-absolute-import
+"""Test checking of log format strings
+"""
+
+import logging
+
+__revision__ = ''
+
+
+def pprint():
+ """Test string format in logging statements.
+ """
+ # These should all emit lint errors:
+ logging.info(0, '') # 1205
+ logging.info('', '') # 1205
+ logging.info('%s%', '') # 1201
+ logging.info('%s%s', '') # 1206
+ logging.info('%s%y', '', '') # 1200
+ logging.info('%s%s', '', '', '') # 1205
+
+ # These should be okay:
+ logging.info(1)
+ logging.info(True)
+ logging.info('')
+ logging.info('%s%')
+ logging.info('%s', '')
+ logging.info('%s%%', '')
+ logging.info('%s%s', '', '')
diff --git a/tests/input/func_e13xx.py b/tests/input/func_e13xx.py
new file mode 100644
index 000000000..227311cb6
--- /dev/null
+++ b/tests/input/func_e13xx.py
@@ -0,0 +1,21 @@
+"""test string format error
+"""
+# pylint: disable=print-statement,unsupported-binary-operation
+from __future__ import print_function
+
+PARG_1 = PARG_2 = PARG_3 = 1
+
+def pprint():
+ """Test string format
+ """
+ print("%s %s" % {'PARG_1': 1, 'PARG_2': 2}) # E1306
+ print("%s" % (PARG_1, PARG_2)) # E1305
+ print("%(PARG_1)d %d" % {'PARG_1': 1, 'PARG_2': 2}) # E1302
+ print("%(PARG_1)d %(PARG_2)d" % {'PARG_1': 1}) # E1304
+ print("%(PARG_1)d %(PARG_2)d" % {'PARG_1': 1, 'PARG_2':2, 'PARG_3':3}) #W1301
+ print("%(PARG_1)d %(PARG_2)d" % {'PARG_1': 1, 2:3}) # W1300 E1304
+ print("%(PARG_1)d %(PARG_2)d" % (2, 3)) # 1303
+ print("%(PARG_1)d %(PARG_2)d" % [2, 3]) # 1303
+ print("%2z" % PARG_1)
+ print("strange format %2" % PARG_2)
+ print("works in 3 %a" % 1)
diff --git a/tests/input/func_excess_escapes.py b/tests/input/func_excess_escapes.py
new file mode 100644
index 000000000..954202195
--- /dev/null
+++ b/tests/input/func_excess_escapes.py
@@ -0,0 +1,30 @@
+# pylint:disable=W0105, W0511, misplaced-comparison-constant, comparison-with-itself
+"""Stray backslash escapes may be missing a raw-string prefix."""
+
+__revision__ = '$Id$'
+
+# Bad escape sequences, which probably don't do what you expect.
+A = "\[\]\\"
+assert '\/' == '\\/'
+ESCAPE_BACKSLASH = '\`'
+
+# Valid escape sequences.
+NEWLINE = "\n"
+OLD_ESCAPES = '\a\b\f\n\t\r\v'
+HEX = '\xad\x0a\x0d'
+FALSE_OCTAL = '\o123\o000' # Not octal in Python
+OCTAL = '\123\000'
+NOT_OCTAL = '\888\999'
+NUL = '\0'
+UNICODE = u'\u1234'
+HIGH_UNICODE = u'\U0000abcd'
+QUOTES = '\'\"'
+LITERAL_NEWLINE = '\
+'
+ESCAPE_UNICODE = "\\\\n"
+
+# Bad docstring
+"""Even in a docstring
+
+You shouldn't have ambiguous text like: C:\Program Files\alpha
+"""
diff --git a/tests/input/func_first_arg.py b/tests/input/func_first_arg.py
new file mode 100644
index 000000000..7df2fd20c
--- /dev/null
+++ b/tests/input/func_first_arg.py
@@ -0,0 +1,42 @@
+# pylint: disable=C0111, W0232, useless-object-inheritance
+"""check for methods first arguments
+"""
+
+__revision__ = 0
+
+
+class Obj(object):
+ # C0202, classmethod
+ def __new__(something):
+ pass
+
+ # C0202, classmethod
+ def class1(cls):
+ pass
+ class1 = classmethod(class1)
+
+ def class2(other):
+ pass
+ class2 = classmethod(class2)
+
+
+class Meta(type):
+ # C0204, metaclass __new__
+ def __new__(other, name, bases, dct):
+ pass
+
+ # C0203, metaclass method
+ def method1(cls):
+ pass
+
+ def method2(other):
+ pass
+
+ # C0205, metaclass classmethod
+ def class1(cls):
+ pass
+ class1 = classmethod(class1)
+
+ def class2(other):
+ pass
+ class2 = classmethod(class2)
diff --git a/tests/input/func_i0011.py b/tests/input/func_i0011.py
new file mode 100644
index 000000000..a4ef215bc
--- /dev/null
+++ b/tests/input/func_i0011.py
@@ -0,0 +1,4 @@
+# pylint:disable=W0404
+"""check warning on local disabling
+"""
+__revision__ = 1
diff --git a/tests/input/func_i0012.py b/tests/input/func_i0012.py
new file mode 100644
index 000000000..9b6fbe79f
--- /dev/null
+++ b/tests/input/func_i0012.py
@@ -0,0 +1,4 @@
+# pylint:enable=W0404
+"""check warning on local enabling
+"""
+__revision__ = 1
diff --git a/tests/input/func_i0013.py b/tests/input/func_i0013.py
new file mode 100644
index 000000000..0a3f83367
--- /dev/null
+++ b/tests/input/func_i0013.py
@@ -0,0 +1,8 @@
+# pylint: skip-file
+"""disable-all is usable as an inline option"""
+
+# no warning should be issued
+try:
+ import this
+except:
+ pass
diff --git a/tests/input/func_i0014.py b/tests/input/func_i0014.py
new file mode 100644
index 000000000..63ff37c9f
--- /dev/null
+++ b/tests/input/func_i0014.py
@@ -0,0 +1,8 @@
+# pylint: disable-all
+"""disable-all is usable as an inline option"""
+
+# no warning should be issued
+try:
+ import this
+except:
+ pass
diff --git a/tests/input/func_i0020.py b/tests/input/func_i0020.py
new file mode 100644
index 000000000..8c0fe9f5c
--- /dev/null
+++ b/tests/input/func_i0020.py
@@ -0,0 +1,8 @@
+"""Test for reporting of suppressed messages."""
+
+__revision__ = 0
+
+def suppressed():
+ """A function with an unused variable."""
+ # pylint: disable=W0612
+ var = 0
diff --git a/tests/input/func_i0022.py b/tests/input/func_i0022.py
new file mode 100644
index 000000000..f5b308f70
--- /dev/null
+++ b/tests/input/func_i0022.py
@@ -0,0 +1,22 @@
+"""Deprecated suppression style."""
+
+__revision__ = None
+
+a = 1 # pylint: disable=invalid-name
+b = 1 # pylint: disable-msg=invalid-name
+
+# pylint: disable=invalid-name
+c = 1
+# pylint: enable=invalid-name
+
+# pylint: disable-msg=invalid-name
+d = 1
+# pylint: enable-msg=invalid-name
+
+# pylint: disable-msg=C0103
+e = 1
+# pylint: enable-msg=C0103
+
+# pylint: disable=C0103
+f = 1
+# pylint: enable=C0103
diff --git a/tests/input/func_logging_not_lazy_with_logger.py b/tests/input/func_logging_not_lazy_with_logger.py
new file mode 100644
index 000000000..973a5c795
--- /dev/null
+++ b/tests/input/func_logging_not_lazy_with_logger.py
@@ -0,0 +1,13 @@
+"""Logging warnings using a logger class."""
+from __future__ import absolute_import
+import logging
+
+__revision__ = ''
+
+LOG = logging.getLogger("domain")
+LOG.debug("%s" % "junk")
+LOG.log(logging.DEBUG, "%s" % "junk")
+LOG2 = LOG.debug
+LOG2("%s" % "junk")
+
+logging.getLogger("domain").debug("%s" % "junk")
diff --git a/tests/input/func_loopvar_in_dict_comp_py27.py b/tests/input/func_loopvar_in_dict_comp_py27.py
new file mode 100644
index 000000000..312eee727
--- /dev/null
+++ b/tests/input/func_loopvar_in_dict_comp_py27.py
@@ -0,0 +1,8 @@
+"""Tests for loopvar-in-closure."""
+
+__revision__ = 0
+
+
+def bad_case():
+ """Loop variable from dict comprehension."""
+ return {x: lambda: x for x in range(10)}
diff --git a/tests/input/func_module___dict__.py b/tests/input/func_module___dict__.py
new file mode 100644
index 000000000..54514224a
--- /dev/null
+++ b/tests/input/func_module___dict__.py
@@ -0,0 +1,9 @@
+"""http://www.logilab.org/ticket/6949."""
+from __future__ import print_function
+__revision__ = None
+
+print(__dict__ is not None)
+
+__dict__ = {}
+
+print(__dict__ is not None)
diff --git a/tests/input/func_nameerror_on_string_substitution.py b/tests/input/func_nameerror_on_string_substitution.py
new file mode 100644
index 000000000..be7b5c82a
--- /dev/null
+++ b/tests/input/func_nameerror_on_string_substitution.py
@@ -0,0 +1,8 @@
+"""pylint doesn't see the NameError in this module"""
+
+__revision__ = None
+
+MSG = "hello %s" % MSG
+
+MSG2 = ("hello %s" %
+ MSG2)
diff --git a/tests/input/func_no_dummy_redefined.py b/tests/input/func_no_dummy_redefined.py
new file mode 100644
index 000000000..a5c0aea4a
--- /dev/null
+++ b/tests/input/func_no_dummy_redefined.py
@@ -0,0 +1,14 @@
+"""Make sure warnings about redefinitions do not trigger for dummy variables."""
+from __future__ import print_function
+
+
+_, INTERESTING = 'a=b'.split('=')
+
+value = 10
+
+
+def clobbering():
+ """Clobbers a dummy name from the outer scope."""
+ value = 9
+ for _ in range(7):
+ print(value)
diff --git a/tests/input/func_noerror___init___return_from_inner_function.py b/tests/input/func_noerror___init___return_from_inner_function.py
new file mode 100644
index 000000000..769d5ac96
--- /dev/null
+++ b/tests/input/func_noerror___init___return_from_inner_function.py
@@ -0,0 +1,12 @@
+# pylint: disable=R0903, useless-object-inheritance
+"""#10075"""
+
+__revision__ = 1
+
+class Aaa(object):
+ """docstring"""
+ def __init__(self):
+ def inner_function(arg):
+ """inner docstring"""
+ return arg + 4
+ self.func = inner_function
diff --git a/tests/input/func_noerror_access_attr_before_def_false_positive.py b/tests/input/func_noerror_access_attr_before_def_false_positive.py
new file mode 100644
index 000000000..3884c9980
--- /dev/null
+++ b/tests/input/func_noerror_access_attr_before_def_false_positive.py
@@ -0,0 +1,98 @@
+#pylint: disable=C0103,R0904,R0903,W0201,no-absolute-import, useless-object-inheritance
+"""
+This module demonstrates a possible problem of pyLint with calling __init__ s
+from inherited classes.
+Initializations done there are not considered, which results in Error E0203 for
+self.cookedq.
+"""
+
+from __future__ import print_function
+
+import telnetlib
+
+class SeeTelnet(telnetlib.Telnet):
+ """
+ Extension of telnetlib.
+ """
+
+ def __init__(self, host=None, port=0):
+ """
+ Constructor.
+ When called without arguments, create an unconnected instance.
+ With a hostname argument, it connects the instance; a port
+ number is optional.
+ Parameter:
+ - host: IP address of the host
+ - port: Port number
+ """
+ telnetlib.Telnet.__init__(self, host, port)
+
+ def readUntilArray(self, matches, _=None):
+ """
+ Read until a given string is encountered or until timeout.
+ ...
+ """
+ self.process_rawq()
+ maxLength = 0
+ for match in matches:
+ if len(match) > maxLength:
+ maxLength = len(match)
+
+class Base(object):
+ """bla bla"""
+ dougloup_papa = None
+
+ def __init__(self):
+ self._var = False
+
+class Derived(Base):
+ """derived blabla"""
+ dougloup_moi = None
+ def Work(self):
+ """do something"""
+ # E0203 - Access to member '_var' before its definition
+ if self._var:
+ print("True")
+ else:
+ print("False")
+ self._var = True
+
+ # E0203 - Access to member 'dougloup_papa' before its definition
+ if self.dougloup_papa:
+ print('dougloup !')
+ self.dougloup_papa = True
+ # E0203 - Access to member 'dougloup_moi' before its definition
+ if self.dougloup_moi:
+ print('dougloup !')
+ self.dougloup_moi = True
+
+
+class QoSALConnection(object):
+ """blabla"""
+
+ _the_instance = None
+
+ def __new__(cls):
+ if cls._the_instance is None:
+ cls._the_instance = object.__new__(cls)
+ return cls._the_instance
+
+ def __init__(self):
+ pass
+
+class DefinedOutsideInit(object):
+ """use_attr is seen as the method defining attr because its in
+ first position
+ """
+ def __init__(self):
+ self.reset()
+
+ def use_attr(self):
+ """use and set members"""
+ if self.attr:
+ print('hop')
+ self.attr = 10
+
+ def reset(self):
+ """reset members"""
+ self.attr = 4
diff --git a/tests/input/func_noerror_base_init_vars.py b/tests/input/func_noerror_base_init_vars.py
new file mode 100644
index 000000000..152cbfd47
--- /dev/null
+++ b/tests/input/func_noerror_base_init_vars.py
@@ -0,0 +1,35 @@
+# pylint:disable=R0201, print-statement, too-few-public-methods, useless-object-inheritance
+"""Checks that class variables are seen as inherited !
+"""
+__revision__ = ''
+
+class BaseClass(object):
+ """A simple base class
+ """
+
+ def __init__(self):
+ self.base_var = {}
+
+ def met(self):
+ """yo"""
+ def meeting(self, with_):
+ """ye"""
+ return with_
+class MyClass(BaseClass):
+ """Inherits from BaseClass
+ """
+
+ def __init__(self):
+ BaseClass.__init__(self)
+ self.var = {}
+
+ def met(self):
+ """Checks that base_var is not seen as defined outsite '__init__'
+ """
+ self.var[1] = 'one'
+ self.base_var[1] = 'one'
+ return self.base_var, self.var
+
+if __name__ == '__main__':
+ OBJ = MyClass()
+ OBJ.met()
diff --git a/tests/input/func_noerror_builtin_module_test.py b/tests/input/func_noerror_builtin_module_test.py
new file mode 100644
index 000000000..9b1e7ce8e
--- /dev/null
+++ b/tests/input/func_noerror_builtin_module_test.py
@@ -0,0 +1,11 @@
+"""test import from a builtin module"""
+
+from __future__ import absolute_import
+from math import log10
+
+__revision__ = None
+
+
+def log10_2():
+ """bla bla bla"""
+ return log10(2)
diff --git a/tests/input/func_noerror_class_attributes.py b/tests/input/func_noerror_class_attributes.py
new file mode 100644
index 000000000..b6fd4601e
--- /dev/null
+++ b/tests/input/func_noerror_class_attributes.py
@@ -0,0 +1,18 @@
+"""Test that valid class attribute doesn't trigger errors"""
+__revision__ = 'sponge bob'
+# pylint: disable=useless-object-inheritance
+
+class Clazz(object):
+ "dummy class"
+
+ def __init__(self):
+ self.topic = 5
+ self._data = 45
+
+ def change_type(self, new_class):
+ """Change type"""
+ self.__class__ = new_class
+
+ def do_nothing(self):
+ "I do nothing useful"
+ return self.topic + 56
diff --git a/tests/input/func_noerror_classes_meth_could_be_a_function.py b/tests/input/func_noerror_classes_meth_could_be_a_function.py
new file mode 100644
index 000000000..05a6c40d7
--- /dev/null
+++ b/tests/input/func_noerror_classes_meth_could_be_a_function.py
@@ -0,0 +1,33 @@
+# pylint: disable=C0111,R0903,W0232, useless-object-inheritance
+"""
+#2479
+
+R0201 (formely W0212), Method could be a function shouldn't be emitted in case
+like factory method pattern
+"""
+__revision__ = 1
+
+class XAsub(object):
+ pass
+class XBsub(XAsub):
+ pass
+class XCsub(XAsub):
+ pass
+
+class Aimpl(object):
+ # disable "method could be a function" on classes which are not overriding
+ # the factory method because in that case the usage of polymorphism is not
+ # detected
+ # pylint: disable=R0201
+ def makex(self):
+ return XAsub()
+
+class Bimpl(Aimpl):
+
+ def makex(self):
+ return XBsub()
+
+class Cimpl(Aimpl):
+
+ def makex(self):
+ return XCsub()
diff --git a/tests/input/func_noerror_classes_protected_member_access.py b/tests/input/func_noerror_classes_protected_member_access.py
new file mode 100644
index 000000000..516efd7d4
--- /dev/null
+++ b/tests/input/func_noerror_classes_protected_member_access.py
@@ -0,0 +1,26 @@
+"""
+#3123: W0212 false positive on static method
+"""
+__revision__ = 1
+
+# pylint: disable=no-classmethod-decorator, no-staticmethod-decorator, useless-object-inheritance
+class A3123(object):
+ """oypuee"""
+ _protected = 1
+ def __init__(self):
+ pass
+
+
+ def cmeth(cls, val):
+ """set protected member"""
+ cls._protected = +val
+
+ cmeth = classmethod(cmeth)
+
+ def smeth(val):
+ """set protected member"""
+ A3123._protected += val
+
+ smeth = staticmethod(smeth)
+
+ prop = property(lambda self: self._protected)
diff --git a/tests/input/func_noerror_decorator_scope.py b/tests/input/func_noerror_decorator_scope.py
new file mode 100644
index 000000000..8d35159e9
--- /dev/null
+++ b/tests/input/func_noerror_decorator_scope.py
@@ -0,0 +1,19 @@
+# -*- pylint: disable=W0232,R0903, useless-object-inheritance
+"""Test that decorators sees the class namespace - just like
+function default values does but function body doesn't.
+
+https://www.logilab.net/elo/ticket/3711 - bug finding decorator arguments
+https://www.logilab.net/elo/ticket/5626 - name resolution bug inside classes
+"""
+
+from __future__ import print_function
+
+class Test(object):
+ """test class"""
+ ident = lambda x: x
+
+ @ident(ident)
+ def method(self, val=ident(7), func=ident):
+ """hop"""
+ print(self)
+ return func(val)
diff --git a/tests/input/func_noerror_e1101_9588_base_attr_aug_assign.py b/tests/input/func_noerror_e1101_9588_base_attr_aug_assign.py
new file mode 100644
index 000000000..14be39853
--- /dev/null
+++ b/tests/input/func_noerror_e1101_9588_base_attr_aug_assign.py
@@ -0,0 +1,38 @@
+# pylint: disable=R0903, useless-object-inheritance
+"""
+False positive case of E1101:
+
+The error is triggered when the attribute set in the base class is
+modified with augmented assignment in a derived class.
+
+http://www.logilab.org/ticket/9588
+"""
+__revision__ = 0
+
+class BaseClass(object):
+ "The base class"
+ def __init__(self):
+ "Set an attribute."
+ self.e1101 = 1
+
+class FalsePositiveClass(BaseClass):
+ "The first derived class which triggers the false positive"
+ def __init__(self):
+ "Augmented assignment triggers E1101."
+ BaseClass.__init__(self)
+ self.e1101 += 1
+
+ def countup(self):
+ "Consequently this also triggers E1101."
+ self.e1101 += 1
+
+class NegativeClass(BaseClass):
+ "The second derived class, which does not trigger the error E1101"
+ def __init__(self):
+ "Ordinary assignment is OK."
+ BaseClass.__init__(self)
+ self.e1101 = self.e1101 + 1
+
+ def countup(self):
+ "No problem."
+ self.e1101 += 1
diff --git a/tests/input/func_noerror_external_classmethod_crash.py b/tests/input/func_noerror_external_classmethod_crash.py
new file mode 100644
index 000000000..e9842a5e5
--- /dev/null
+++ b/tests/input/func_noerror_external_classmethod_crash.py
@@ -0,0 +1,21 @@
+# pylint: disable=W0232,R0903,W0613, useless-object-inheritance
+"""tagging a function as a class method cause a crash when checking for
+signature overriding
+"""
+
+def fetch_config(mainattr=None):
+ """return a class method"""
+
+ def fetch_order(cls, attr, var):
+ """a class method"""
+ if attr == mainattr:
+ return var
+ return None
+ fetch_order = classmethod(fetch_order)
+ return fetch_order
+
+class Aaa(object):
+ """hop"""
+ fetch_order = fetch_config('A')
+
+__revision__ = None
diff --git a/tests/input/func_noerror_inner_classes.py b/tests/input/func_noerror_inner_classes.py
new file mode 100644
index 000000000..24a2edb80
--- /dev/null
+++ b/tests/input/func_noerror_inner_classes.py
@@ -0,0 +1,33 @@
+# pylint: disable=R0903, useless-object-inheritance, unnecessary-pass
+"""Backend Base Classes for the schwelm user DB"""
+
+__revision__ = "alpha"
+
+class Aaa(object):
+ """docstring"""
+ def __init__(self):
+ self.__setattr__('a', 'b')
+
+
+ def one_public(self):
+ """docstring"""
+ pass
+
+ def another_public(self):
+ """docstring"""
+ pass
+
+class Bbb(Aaa):
+ """docstring"""
+ pass
+
+class Ccc(Aaa):
+ """docstring"""
+
+ class Ddd(Aaa):
+ """docstring"""
+ pass
+
+ class Eee(Ddd):
+ """docstring"""
+ pass
diff --git a/tests/input/func_noerror_lambda_use_before_assign.py b/tests/input/func_noerror_lambda_use_before_assign.py
new file mode 100644
index 000000000..af2775cae
--- /dev/null
+++ b/tests/input/func_noerror_lambda_use_before_assign.py
@@ -0,0 +1,8 @@
+"""https://www.logilab.net/elo/ticket/18862"""
+from __future__ import print_function
+__revision__ = 1
+def function():
+ """hop"""
+ ggg = lambda: xxx
+ xxx = 1
+ print(ggg())
diff --git a/tests/input/func_noerror_mcs_attr_access.py b/tests/input/func_noerror_mcs_attr_access.py
new file mode 100644
index 000000000..149e07812
--- /dev/null
+++ b/tests/input/func_noerror_mcs_attr_access.py
@@ -0,0 +1,20 @@
+# pylint: disable=R0903, metaclass-assignment, useless-object-inheritance
+"""test attribute access on metaclass"""
+
+
+from __future__ import print_function
+
+class Meta(type):
+ """the meta class"""
+ def __init__(cls, name, bases, dictionary):
+ super(Meta, cls).__init__(name, bases, dictionary)
+ print(cls, cls._meta_args)
+ delattr(cls, '_meta_args')
+
+class Test(object):
+ """metaclassed class"""
+ __metaclass__ = Meta
+ _meta_args = ('foo', 'bar')
+
+ def __init__(self):
+ print('__init__', self)
diff --git a/tests/input/func_noerror_new_style_class_py_30.py b/tests/input/func_noerror_new_style_class_py_30.py
new file mode 100644
index 000000000..a33ae19f4
--- /dev/null
+++ b/tests/input/func_noerror_new_style_class_py_30.py
@@ -0,0 +1,45 @@
+"""check builtin data descriptors such as mode and name attributes
+on a file are correctly handled
+
+bug notified by Pierre Rouleau on 2005-04-24
+"""
+from __future__ import print_function
+__revision__ = None
+
+class File(file): # pylint: disable=file-builtin
+ """ Testing new-style class inheritance from file"""
+
+ #
+ def __init__(self, name, mode="r", buffering=-1, verbose=False):
+ """Constructor"""
+
+ self.was_modified = False
+ self.verbose = verbose
+ super(File, self).__init__(name, mode, buffering)
+ if self.verbose:
+ print("File %s is opened. The mode is: %s" % (self.name,
+ self.mode))
+
+ #
+ def write(self, a_string):
+ """ Write a string to the file."""
+
+ super(File, self).write(a_string)
+ self.was_modified = True
+
+ #
+ def writelines(self, sequence):
+ """ Write a sequence of strings to the file. """
+
+ super(File, self).writelines(sequence)
+ self.was_modified = True
+
+ #
+ def close(self):
+ """Close the file."""
+
+ if self.verbose:
+ print("Closing file %s" % self.name)
+
+ super(File, self).close()
+ self.was_modified = False
diff --git a/tests/input/func_noerror_no_warning_docstring.py b/tests/input/func_noerror_no_warning_docstring.py
new file mode 100644
index 000000000..315eeeaab
--- /dev/null
+++ b/tests/input/func_noerror_no_warning_docstring.py
@@ -0,0 +1,42 @@
+''' Test for inheritance '''
+from __future__ import print_function
+__revision__ = 1
+# pylint: disable=too-few-public-methods, using-constant-test, useless-object-inheritance
+class AAAA(object):
+ ''' class AAAA '''
+
+ def __init__(self):
+ pass
+
+ def method1(self):
+ ''' method 1 '''
+ print(self)
+
+ def method2(self):
+ ''' method 2 '''
+ print(self)
+
+class BBBB(AAAA):
+ ''' class BBBB '''
+
+ def __init__(self):
+ AAAA.__init__(self)
+
+ # should ignore docstring calling from class AAAA
+ def method1(self):
+ AAAA.method1(self)
+
+class CCCC(BBBB):
+ ''' class CCCC '''
+
+ def __init__(self):
+ BBBB.__init__(self)
+
+ # should ignore docstring since CCCC is inherited from BBBB which is
+ # inherited from AAAA containing method2
+ if __revision__:
+ def method2(self):
+ AAAA.method2(self)
+ else:
+ def method2(self):
+ AAAA.method1(self)
diff --git a/tests/input/func_noerror_object_as_class_attribute.py b/tests/input/func_noerror_object_as_class_attribute.py
new file mode 100644
index 000000000..71cd027b7
--- /dev/null
+++ b/tests/input/func_noerror_object_as_class_attribute.py
@@ -0,0 +1,18 @@
+# pylint: disable=R0903, useless-object-inheritance
+"""Test case for the problem described below :
+ - A class extends 'object'
+ - This class defines its own __init__()
+ * pylint will therefore check that baseclasses' init()
+ are called
+ - If this class defines an 'object' attribute, then pylint
+ will use this new definition when trying to retrieve
+ object.__init__()
+"""
+
+__revision__ = None
+
+class Statement(object):
+ """ ... """
+ def __init__(self):
+ pass
+ object = None
diff --git a/tests/input/func_noerror_overloaded_operator.py b/tests/input/func_noerror_overloaded_operator.py
new file mode 100644
index 000000000..3a158b00b
--- /dev/null
+++ b/tests/input/func_noerror_overloaded_operator.py
@@ -0,0 +1,21 @@
+# pylint: disable=C0111,R0903, useless-object-inheritance
+"""#3291"""
+from __future__ import print_function
+
+class Myarray(object):
+ def __init__(self, array):
+ self.array = array
+
+ def __mul__(self, val):
+ return Myarray(val)
+
+ def astype(self):
+ return "ASTYPE", self
+
+def randint(maximum):
+ if maximum is not None:
+ return Myarray([1, 2, 3]) * 2
+
+ return int(5)
+
+print(randint(1).astype()) # we don't wan't an error for astype access
diff --git a/tests/input/func_noerror_property_affectation_py26.py b/tests/input/func_noerror_property_affectation_py26.py
new file mode 100644
index 000000000..60118bbf6
--- /dev/null
+++ b/tests/input/func_noerror_property_affectation_py26.py
@@ -0,0 +1,24 @@
+# pylint: disable=R0903, useless-object-inheritance
+"""
+Simple test case for an annoying behavior in pylint.
+"""
+
+__revision__ = 'pouet'
+
+class Test(object):
+ """Smallest test case for reported issue."""
+
+ def __init__(self):
+ self._thing = None
+
+ @property
+ def myattr(self):
+ """Getter for myattr"""
+ return self._thing
+
+ @myattr.setter
+ def myattr(self, value):
+ """Setter for myattr."""
+ self._thing = value
+
+Test().myattr = 'grou'
diff --git a/tests/input/func_noerror_yield_assign_py25.py b/tests/input/func_noerror_yield_assign_py25.py
new file mode 100644
index 000000000..f40d8d96e
--- /dev/null
+++ b/tests/input/func_noerror_yield_assign_py25.py
@@ -0,0 +1,21 @@
+"""http://www.logilab.org/ticket/8771"""
+
+from __future__ import print_function
+
+def generator():
+ """yield as assignment"""
+ yield 45
+ xxxx = yield 123
+ print(xxxx)
+
+def generator_fp1(seq):
+ """W0631 false positive"""
+ for val in seq:
+ pass
+ for val in seq:
+ yield val
+
+def generator_fp2():
+ """E0601 false positive"""
+ xxxx = 12
+ yield xxxx
diff --git a/tests/input/func_noerror_yield_return_mix.py b/tests/input/func_noerror_yield_return_mix.py
new file mode 100644
index 000000000..8e050f0f0
--- /dev/null
+++ b/tests/input/func_noerror_yield_return_mix.py
@@ -0,0 +1,8 @@
+""" module doc """
+# pylint: disable=useless-return
+__revision__ = None
+
+def somegen():
+ """this kind of mix is OK"""
+ yield 1
+ return
diff --git a/tests/input/func_nonregr___file___global.py b/tests/input/func_nonregr___file___global.py
new file mode 100644
index 000000000..910033c4a
--- /dev/null
+++ b/tests/input/func_nonregr___file___global.py
@@ -0,0 +1,8 @@
+"""test no crash on __file__ global"""
+
+def func():
+ """override __file__"""
+ global __file__
+ __file__ = 'hop'
+
+__revision__ = 'pouet'
diff --git a/tests/input/func_return_yield_mix_py_33.py b/tests/input/func_return_yield_mix_py_33.py
new file mode 100644
index 000000000..b120b80ac
--- /dev/null
+++ b/tests/input/func_return_yield_mix_py_33.py
@@ -0,0 +1,15 @@
+"""pylint should detect yield and return mix inside generators"""
+# pylint: disable=using-constant-test, inconsistent-return-statements
+def somegen():
+ """this is a bad generator"""
+ if True:
+ return 1
+ else:
+ yield 2
+
+def moregen():
+ """this is another bad generator"""
+ if True:
+ yield 1
+ else:
+ return 2
diff --git a/tests/input/func_typecheck_callfunc_assigment.py b/tests/input/func_typecheck_callfunc_assigment.py
new file mode 100644
index 000000000..36d476e89
--- /dev/null
+++ b/tests/input/func_typecheck_callfunc_assigment.py
@@ -0,0 +1,61 @@
+# pylint: disable=useless-return, useless-object-inheritance
+"""check assignment to function call where the function doesn't return
+
+ 'E1111': ('Assigning to function call which doesn\'t return',
+ 'Used when an assignment is done on a function call but the \
+ infered function doesn\'t return anything.'),
+ 'W1111': ('Assigning to function call which only returns None',
+ 'Used when an assignment is done on a function call but the \
+ infered function returns nothing but None.'),
+
+"""
+from __future__ import generators, print_function
+
+def func_no_return():
+ """function without return"""
+ print('dougloup')
+
+A = func_no_return()
+
+
+def func_return_none():
+ """function returning none"""
+ print('dougloup')
+ return None
+
+A = func_return_none()
+
+
+def func_implicit_return_none():
+ """Function returning None from bare return statement."""
+ return
+
+A = func_implicit_return_none()
+
+
+def func_return_none_and_smth():
+ """function returning none and something else"""
+ print('dougloup')
+ if 2 or 3:
+ return None
+ return 3
+
+A = func_return_none_and_smth()
+
+def generator():
+ """no problemo"""
+ yield 2
+
+A = generator()
+
+class Abstract(object):
+ """bla bla"""
+
+ def abstract_method(self):
+ """use to return something in concrete implementation"""
+ raise NotImplementedError
+
+ def use_abstract(self):
+ """should not issue E1111"""
+ var = self.abstract_method()
+ print(var)
diff --git a/tests/input/func_unused_import_py30.py b/tests/input/func_unused_import_py30.py
new file mode 100644
index 000000000..91a9e9ac9
--- /dev/null
+++ b/tests/input/func_unused_import_py30.py
@@ -0,0 +1,20 @@
+"""check unused import for metaclasses
+"""
+# pylint: disable=too-few-public-methods,wrong-import-position,ungrouped-imports
+__revision__ = 1
+import abc
+import sys
+from abc import ABCMeta
+from abc import ABCMeta as SomethingElse
+
+class Meta(metaclass=abc.ABCMeta):
+ """ Test """
+ def __init__(self):
+ self.data = sys.executable
+ self.test = abc
+
+class Meta2(metaclass=ABCMeta):
+ """ Test """
+
+class Meta3(metaclass=SomethingElse):
+ """ test """
diff --git a/tests/input/func_variables_unused_name_from_wilcard_import.py b/tests/input/func_variables_unused_name_from_wilcard_import.py
new file mode 100644
index 000000000..bb92155c6
--- /dev/null
+++ b/tests/input/func_variables_unused_name_from_wilcard_import.py
@@ -0,0 +1,3 @@
+"""check unused import from a wildcard import"""
+# pylint: disable=no-absolute-import
+from input.func_w0611 import *
diff --git a/tests/input/func_w0122_py_30.py b/tests/input/func_w0122_py_30.py
new file mode 100644
index 000000000..6b8669130
--- /dev/null
+++ b/tests/input/func_w0122_py_30.py
@@ -0,0 +1,12 @@
+"""test global statement"""
+
+__revision__ = 0
+
+exec 'a = __revision__'
+exec 'a = 1' in {}
+
+exec 'a = 1' in globals()
+
+def func():
+ """exec in local scope"""
+ exec 'b = 1'
diff --git a/tests/input/func_w0233.py b/tests/input/func_w0233.py
new file mode 100644
index 000000000..eb5d97226
--- /dev/null
+++ b/tests/input/func_w0233.py
@@ -0,0 +1,51 @@
+# pylint: disable=R0903,W0212,W0403,W0406,no-absolute-import,wrong-import-order, useless-object-inheritance
+
+"""test for call to __init__ from a non ancestor class
+"""
+from __future__ import print_function
+from . import func_w0233
+import nonexistant
+__revision__ = '$Id: func_w0233.py,v 1.2 2004-09-29 08:35:13 syt Exp $'
+
+class AAAA(object):
+ """ancestor 1"""
+
+ def __init__(self):
+ print('init', self)
+ BBBBMixin.__init__(self)
+
+class BBBBMixin(object):
+ """ancestor 2"""
+
+ def __init__(self):
+ print('init', self)
+
+class CCC(BBBBMixin, func_w0233.AAAA, func_w0233.BBBB, nonexistant.AClass):
+ """mix different things, some inferable some not"""
+ def __init__(self):
+ BBBBMixin.__init__(self)
+ func_w0233.AAAA.__init__(self)
+ func_w0233.BBBB.__init__(self)
+ nonexistant.AClass.__init__(self)
+
+class DDDD(AAAA):
+ """call superclass constructor in disjunct branches"""
+ def __init__(self, value):
+ if value:
+ AAAA.__init__(self)
+ else:
+ AAAA.__init__(self)
+
+class Super(dict):
+ """ test late binding super() call """
+ def __init__(self):
+ base = super()
+ base.__init__()
+
+class Super2(dict):
+ """ Using the same idiom as Super, but without calling
+ the __init__ method.
+ """
+ def __init__(self):
+ base = super()
+ base.__woohoo__()
diff --git a/tests/input/func_w0332_py_30.py b/tests/input/func_w0332_py_30.py
new file mode 100644
index 000000000..6a38e8c0d
--- /dev/null
+++ b/tests/input/func_w0332_py_30.py
@@ -0,0 +1,4 @@
+"""check use of l as long int marker
+"""
+# pylint: disable=long-suffix
+__revision__ = 1l
diff --git a/tests/input/func_w0401.py b/tests/input/func_w0401.py
new file mode 100644
index 000000000..12227bc9a
--- /dev/null
+++ b/tests/input/func_w0401.py
@@ -0,0 +1,9 @@
+"""test cyclic import
+"""
+# pylint: disable=no-absolute-import
+from __future__ import print_function
+
+from . import w0401_cycle
+
+if w0401_cycle:
+ print(w0401_cycle)
diff --git a/tests/input/func_w0401_disabled.py b/tests/input/func_w0401_disabled.py
new file mode 100644
index 000000000..966706caf
--- /dev/null
+++ b/tests/input/func_w0401_disabled.py
@@ -0,0 +1,9 @@
+"""test cyclic import
+"""
+# pylint: disable=no-absolute-import
+from __future__ import print_function
+
+from . import w0401_cycle # pylint: disable=cyclic-import
+
+if w0401_cycle:
+ print(w0401_cycle)
diff --git a/tests/input/func_w0401_disabled_in_func.py b/tests/input/func_w0401_disabled_in_func.py
new file mode 100644
index 000000000..b9b0ced8d
--- /dev/null
+++ b/tests/input/func_w0401_disabled_in_func.py
@@ -0,0 +1,11 @@
+"""Test disabling of cyclic import check inside a function
+"""
+# pylint: disable=no-absolute-import
+from __future__ import print_function
+
+
+def func():
+ """Test disabling of cyclic import check inside a function"""
+ from . import w0401_cycle # pylint: disable=cyclic-import
+ if w0401_cycle:
+ print(w0401_cycle)
diff --git a/tests/input/func_w0401_package/__init__.py b/tests/input/func_w0401_package/__init__.py
new file mode 100644
index 000000000..dedef6608
--- /dev/null
+++ b/tests/input/func_w0401_package/__init__.py
@@ -0,0 +1,2 @@
+"""Our big package."""
+__revision__ = None
diff --git a/tests/input/func_w0401_package/all_the_things.py b/tests/input/func_w0401_package/all_the_things.py
new file mode 100644
index 000000000..b8bd47b9e
--- /dev/null
+++ b/tests/input/func_w0401_package/all_the_things.py
@@ -0,0 +1,9 @@
+"""All the things!"""
+# pylint: disable=no-absolute-import
+from .thing1 import THING1
+from .thing2 import THING2
+from .thing2 import THING1_PLUS_THING2
+__revision__ = None
+
+_ = (THING1, THING2, THING1_PLUS_THING2)
+del _
diff --git a/tests/input/func_w0401_package/thing1.py b/tests/input/func_w0401_package/thing1.py
new file mode 100644
index 000000000..34972a7d2
--- /dev/null
+++ b/tests/input/func_w0401_package/thing1.py
@@ -0,0 +1,3 @@
+"""The first thing."""
+__revision__ = None
+THING1 = "I am thing1"
diff --git a/tests/input/func_w0401_package/thing2.py b/tests/input/func_w0401_package/thing2.py
new file mode 100644
index 000000000..66d331677
--- /dev/null
+++ b/tests/input/func_w0401_package/thing2.py
@@ -0,0 +1,7 @@
+"""The second thing."""
+# pylint: disable=no-absolute-import
+from .all_the_things import THING1
+__revision__ = None
+
+THING2 = "I am thing2"
+THING1_PLUS_THING2 = "%s, plus %s" % (THING1, THING2)
diff --git a/tests/input/func_w0404.py b/tests/input/func_w0404.py
new file mode 100644
index 000000000..2ce7d651c
--- /dev/null
+++ b/tests/input/func_w0404.py
@@ -0,0 +1,27 @@
+"""Unittests for W0404 (reimport)"""
+from __future__ import absolute_import, print_function
+
+import sys
+
+import xml.etree.ElementTree
+from xml.etree import ElementTree
+
+from email import encoders
+import email.encoders
+
+import sys #pylint: disable=ungrouped-imports,wrong-import-order
+__revision__ = 0
+
+def no_reimport():
+ """docstring"""
+ import os
+ print(os)
+
+
+def reimport():
+ """This function contains a reimport."""
+ import sys
+ del sys
+
+
+del sys, ElementTree, xml.etree.ElementTree, encoders, email.encoders
diff --git a/tests/input/func_w0405.py b/tests/input/func_w0405.py
new file mode 100644
index 000000000..50a069d7a
--- /dev/null
+++ b/tests/input/func_w0405.py
@@ -0,0 +1,31 @@
+"""check reimport
+"""
+from __future__ import absolute_import, print_function
+
+# pylint: disable=using-constant-test,ungrouped-imports,wrong-import-position
+import os
+from os.path import join, exists
+import os
+import re as _re
+
+__revision__ = 0
+_re.match('yo', '.*')
+
+if __revision__:
+ print(os)
+ from os.path import exists
+ print(join, exists)
+
+def func(yooo):
+ """reimport in different scope"""
+ import os as ass
+ ass.remove(yooo)
+ import re
+ re.compile('.*')
+
+if 1: # pylint: disable=using-constant-test
+ import sys
+ print(sys.modules)
+else:
+ print('bla')
+ import sys
diff --git a/tests/input/func_w0406.py b/tests/input/func_w0406.py
new file mode 100644
index 000000000..ceb12b5ff
--- /dev/null
+++ b/tests/input/func_w0406.py
@@ -0,0 +1,10 @@
+"""test module importing itself"""
+# pylint: disable=no-absolute-import,using-constant-test
+from __future__ import print_function
+from . import func_w0406
+
+__revision__ = 0
+
+
+if __revision__:
+ print(func_w0406)
diff --git a/tests/input/func_w0611.py b/tests/input/func_w0611.py
new file mode 100644
index 000000000..887787242
--- /dev/null
+++ b/tests/input/func_w0611.py
@@ -0,0 +1,25 @@
+"""check unused import
+"""
+# pylint: disable=no-absolute-import, useless-object-inheritance
+
+from __future__ import print_function
+
+import os
+import sys
+
+class NonRegr(object):
+ """???"""
+ def __init__(self):
+ print('initialized')
+
+ def sys(self):
+ """should not get sys from there..."""
+ print(self, sys)
+
+ def dummy(self, truc):
+ """yo"""
+ return self, truc
+
+ def blop(self):
+ """yo"""
+ print(self, 'blip')
diff --git a/tests/input/func_w0612.py b/tests/input/func_w0612.py
new file mode 100644
index 000000000..3d873bbeb
--- /dev/null
+++ b/tests/input/func_w0612.py
@@ -0,0 +1,37 @@
+"""test unused variable
+"""
+# pylint: disable=invalid-name, redefined-outer-name, no-absolute-import
+from __future__ import print_function
+PATH = OS = collections = deque = None
+
+def function(matches):
+ """"yo"""
+ aaaa = 1
+ index = -1
+ for match in matches:
+ index += 1
+ print(match)
+
+def visit_if(self, node):
+ """increments the branches counter"""
+ branches = 1
+ # don't double count If nodes coming from some 'elif'
+ if node.orelse and len(node.orelse) > 1:
+ branches += 1
+ self.inc_branch(branches)
+ self.stmts += branches
+
+def test_global():
+ """ Test various assignments of global
+ variables through imports.
+ """
+ global PATH, OS, collections, deque
+ from os import path as PATH
+ import os as OS
+ import collections
+ from collections import deque
+ # make sure that these triggers unused-variable
+ from sys import platform
+ from sys import version as VERSION
+ import this
+ import re as RE
diff --git a/tests/input/func_w0613.py b/tests/input/func_w0613.py
new file mode 100644
index 000000000..02213c83b
--- /dev/null
+++ b/tests/input/func_w0613.py
@@ -0,0 +1,42 @@
+# pylint: disable=R0903, print-statement, useless-object-inheritance
+"""test unused argument
+"""
+from __future__ import print_function
+
+
+def function(arg=1):
+ """ignore arg"""
+
+
+class AAAA(object):
+ """dummy class"""
+
+ def method(self, arg):
+ """dummy method"""
+ print(self)
+ def __init__(self, *unused_args, **unused_kwargs):
+ pass
+
+ @classmethod
+ def selected(cls, *args, **kwargs):
+ """called by the registry when the vobject has been selected.
+ """
+ return cls
+
+ def using_inner_function(self, etype, size=1):
+ """return a fake result set for a particular entity type"""
+ rset = AAAA([('A',)]*size, '%s X' % etype,
+ description=[(etype,)]*size)
+ def inner(row, col=0, etype=etype, req=self, rset=rset):
+ """inner using all its argument"""
+ # pylint: disable = E1103
+ return req.vreg.etype_class(etype)(req, rset, row, col)
+ # pylint: disable = W0201
+ rset.get_entity = inner
+
+class BBBB(object):
+ """dummy class"""
+
+ def __init__(self, arg):
+ """Constructor with an extra parameter. Should raise a warning"""
+ self.spam = 1
diff --git a/tests/input/func_w0623_py30.py b/tests/input/func_w0623_py30.py
new file mode 100644
index 000000000..7eb27a923
--- /dev/null
+++ b/tests/input/func_w0623_py30.py
@@ -0,0 +1,17 @@
+"""Test for W0623, overwriting names in exception handlers."""
+# pylint: disable=unnecessary-pass
+
+__revision__ = ''
+
+class MyError(Exception):
+ """Special exception class."""
+ pass
+
+
+def some_function():
+ """A function."""
+
+ try:
+ {}["a"]
+ except KeyError as some_function: # W0623
+ pass
diff --git a/tests/input/func_w0801.py b/tests/input/func_w0801.py
new file mode 100644
index 000000000..cd386ff55
--- /dev/null
+++ b/tests/input/func_w0801.py
@@ -0,0 +1,11 @@
+"""test code similarities
+by defaut docstring are not considered
+"""
+__revision__ = 'id'
+A = 2
+B = 3
+C = A + B
+# need more than X lines to trigger the message
+C *= 2
+A -= B
+# all this should be detected
diff --git a/tests/input/hide_code_with_imports.py b/tests/input/hide_code_with_imports.py
new file mode 100644
index 000000000..a8449c9b9
--- /dev/null
+++ b/tests/input/hide_code_with_imports.py
@@ -0,0 +1,16 @@
+quicksort = lambda a: qs1(a,0,len(a)-1) ; import a
+qs1 = lambda a,lo,hi: qs2(a,lo,hi) if lo<hi else a ; import b
+qs2 = lambda a,lo,hi: qs3(lo,hi,*qsp(a,lo,hi)) ; import c
+qs3 = lambda lo,hi,a,p: qs1(qs1(a,p+1,hi),lo,p-1) ; import d
+qsp = lambda a,lo,hi: qsp1(a,lo,hi,a[hi],lo,lo) ; import e
+qsp1 = lambda a,lo,hi,p,i,j: qsp2(a,lo,hi,p,i,j,j<hi) ; import f
+qsp2 = lambda a,lo,hi,p,i,j,c: qspt(a,lo,hi,p,i,j,qsp3 if c else qsp7); import g
+qspt = lambda a,lo,hi,p,i,j,n: n(a,lo,hi,p,i,j) ; import h
+qsp3 = lambda a,lo,hi,p,i,j: qsp4(a,lo,hi,p,i,j,a[j]<p) ; import i
+qsp4 = lambda a,lo,hi,p,i,j,c: qspt(a,lo,hi,p,i,j,qsp5 if c else qsp6); import j
+qsp5 = lambda a,lo,hi,p,i,j: qsp1(sw(a,i,j),lo,hi,p,i+1,j+1) ; import k
+qsp6 = lambda a,lo,hi,p,i,j: qsp1(a,lo,hi,p,i,j+1) ; import l
+qsp7 = lambda a,lo,hi,p,i,j: (sw(a,i,hi), i) ; import m
+sw = lambda a,i,j: sw1(enumerate(a),i,j,a[i],(-1,a[j])) ; import n
+sw1 = lambda a,i,j,ai,aj: sw2([aj if x[0]==i else x for x in a],j,ai) ; import o
+sw2 = lambda a,j,ai: [ai if x[0]==j else x[1] for x in a] ; import p
diff --git a/tests/input/ignore_except_pass_by_default.py b/tests/input/ignore_except_pass_by_default.py
new file mode 100644
index 000000000..444e540d2
--- /dev/null
+++ b/tests/input/ignore_except_pass_by_default.py
@@ -0,0 +1,6 @@
+"""#5575: by default no W0704 warning on bare pass in except"""
+
+try:
+ __exception__ = 0
+except ValueError:
+ pass
diff --git a/tests/input/multiline-import b/tests/input/multiline-import
new file mode 100644
index 000000000..b9507ef8a
--- /dev/null
+++ b/tests/input/multiline-import
@@ -0,0 +1,8 @@
+from foo import (
+ bar,
+ baz,
+ quux,
+ quuux,
+ quuuux,
+ quuuuux,
+)
diff --git a/tests/input/noext b/tests/input/noext
new file mode 100644
index 000000000..8aeda06d3
--- /dev/null
+++ b/tests/input/noext
@@ -0,0 +1,4 @@
+#!/usr/bin/env python
+"""a python file without .py extension"""
+
+__revision__ = None
diff --git a/tests/input/not__init__.py b/tests/input/not__init__.py
new file mode 100644
index 000000000..60e92b76c
--- /dev/null
+++ b/tests/input/not__init__.py
@@ -0,0 +1 @@
+"""test"""
diff --git a/tests/input/similar1 b/tests/input/similar1
new file mode 100644
index 000000000..a533e2f6f
--- /dev/null
+++ b/tests/input/similar1
@@ -0,0 +1,30 @@
+import one
+from two import two
+three
+four
+five
+six # comments optionally ignored
+seven
+eight
+nine
+''' ten
+eleven
+twelve '''
+thirteen
+fourteen
+fifteen
+
+
+
+
+sixteen
+seventeen
+eighteen
+
+
+
+
+nineteen
+r"""
+twenty
+"""
diff --git a/tests/input/similar2 b/tests/input/similar2
new file mode 100644
index 000000000..79bcab2fd
--- /dev/null
+++ b/tests/input/similar2
@@ -0,0 +1,30 @@
+import one
+from two import two
+three
+four
+five
+six
+seven
+eight
+nine
+''' ten
+ELEVEN
+twelve '''
+thirteen
+fourteen
+FIFTEEN
+
+
+
+
+sixteen
+seventeen
+eighteen
+
+
+
+
+NINETEEN
+r"""
+twenty
+"""
diff --git a/tests/input/w0401_cycle.py b/tests/input/w0401_cycle.py
new file mode 100644
index 000000000..ddb42557e
--- /dev/null
+++ b/tests/input/w0401_cycle.py
@@ -0,0 +1,9 @@
+"""w0401 dependency
+"""
+# pylint: disable=print-statement, no-absolute-import
+from __future__ import print_function
+
+from . import func_w0401
+
+if func_w0401:
+ print(input)
diff --git a/tests/input/w0801_same.py b/tests/input/w0801_same.py
new file mode 100644
index 000000000..cd386ff55
--- /dev/null
+++ b/tests/input/w0801_same.py
@@ -0,0 +1,11 @@
+"""test code similarities
+by defaut docstring are not considered
+"""
+__revision__ = 'id'
+A = 2
+B = 3
+C = A + B
+# need more than X lines to trigger the message
+C *= 2
+A -= B
+# all this should be detected