summaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/b/bad_reversed_sequence.py8
-rw-r--r--tests/functional/b/bugfix_local_scope_metaclass_1177.py4
-rw-r--r--tests/functional/c/consider_using_enumerate.py1
-rw-r--r--tests/functional/import_outside_toplevel.py4
-rw-r--r--tests/functional/import_outside_toplevel.txt1
-rw-r--r--tests/functional/r/redefined_outer_name_type_checking.py1
-rw-r--r--tests/functional/s/string_formatting.py2
-rw-r--r--tests/functional/s/string_formatting_py3.py2
-rw-r--r--tests/functional/u/unbalanced_tuple_unpacking.py2
9 files changed, 13 insertions, 12 deletions
diff --git a/tests/functional/b/bad_reversed_sequence.py b/tests/functional/b/bad_reversed_sequence.py
index 6cfac5bed..f423dd2d6 100644
--- a/tests/functional/b/bad_reversed_sequence.py
+++ b/tests/functional/b/bad_reversed_sequence.py
@@ -1,9 +1,9 @@
""" Checks that reversed() receive proper argument """
# pylint: disable=missing-docstring, useless-object-inheritance
# pylint: disable=too-few-public-methods,no-self-use,no-absolute-import
-from collections import deque
+from collections import deque, OrderedDict
+from enum import IntEnum
-__revision__ = 0
class GoodReversed(object):
""" Implements __reversed__ """
@@ -61,8 +61,6 @@ def test(path):
def test_dict_ancestor_and_reversed():
"""Don't emit for subclasses of dict, with __reversed__ implemented."""
- from collections import OrderedDict
-
class Child(dict):
def __reversed__(self):
return reversed(range(10))
@@ -73,8 +71,6 @@ def test_dict_ancestor_and_reversed():
def test_dont_emit_for_reversing_enums():
"""Don't emit when reversing enum classes"""
- from enum import IntEnum
-
class Color(IntEnum):
RED = 1
GREEN = 2
diff --git a/tests/functional/b/bugfix_local_scope_metaclass_1177.py b/tests/functional/b/bugfix_local_scope_metaclass_1177.py
index 8904f6fb2..22c07a330 100644
--- a/tests/functional/b/bugfix_local_scope_metaclass_1177.py
+++ b/tests/functional/b/bugfix_local_scope_metaclass_1177.py
@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring,too-few-public-methods,import-error
-from UNINFERABLE import ImportedMetaclass
+from UNINFERABLE import ImportedMetaclass, ImportedMetaclass2
class Meta(type):
@@ -48,8 +48,6 @@ def imported_and_nested_scope1():
def imported_and_nested_scope2():
- from UNINFERABLE import ImportedMetaclass2
-
class ClassImp3(metaclass=ImportedMetaclass2):
pass
diff --git a/tests/functional/c/consider_using_enumerate.py b/tests/functional/c/consider_using_enumerate.py
index 758375c37..cff00aeec 100644
--- a/tests/functional/c/consider_using_enumerate.py
+++ b/tests/functional/c/consider_using_enumerate.py
@@ -49,6 +49,7 @@ def good():
for index in range(len(iterable)):
yield other_obj[index]
+ # pylint: disable=import-outside-toplevel
from unknown import unknown
for index in range(unknown(iterable)):
yield iterable[index]
diff --git a/tests/functional/import_outside_toplevel.py b/tests/functional/import_outside_toplevel.py
index 0575e59b2..762faa551 100644
--- a/tests/functional/import_outside_toplevel.py
+++ b/tests/functional/import_outside_toplevel.py
@@ -32,3 +32,7 @@ class C:
def k(flag):
if flag:
import tabnanny # [import-outside-toplevel]
+
+
+def j():
+ from collections import defaultdict # [import-outside-toplevel]
diff --git a/tests/functional/import_outside_toplevel.txt b/tests/functional/import_outside_toplevel.txt
index 53f9595d2..d15db6947 100644
--- a/tests/functional/import_outside_toplevel.txt
+++ b/tests/functional/import_outside_toplevel.txt
@@ -5,3 +5,4 @@ import-outside-toplevel:22:i:Import outside toplevel (random, socket)
import-outside-toplevel:26:C:Import outside toplevel (tokenize)
import-outside-toplevel:29:C.j:Import outside toplevel (turtle)
import-outside-toplevel:34:k:Import outside toplevel (tabnanny)
+import-outside-toplevel:38:j:Import outside toplevel (collections)
diff --git a/tests/functional/r/redefined_outer_name_type_checking.py b/tests/functional/r/redefined_outer_name_type_checking.py
index b708902e0..399fc8cea 100644
--- a/tests/functional/r/redefined_outer_name_type_checking.py
+++ b/tests/functional/r/redefined_outer_name_type_checking.py
@@ -8,6 +8,7 @@ from typing import TYPE_CHECKING
class Cls:
def func(self, stuff: defaultdict):
# This import makes the definition work.
+ # pylint: disable=import-outside-toplevel
from collections import defaultdict
obj = defaultdict()
diff --git a/tests/functional/s/string_formatting.py b/tests/functional/s/string_formatting.py
index 82f6d112d..bb7166fde 100644
--- a/tests/functional/s/string_formatting.py
+++ b/tests/functional/s/string_formatting.py
@@ -134,7 +134,7 @@ def issue338():
trying to infer EmptyNodes (resulted after mocking the
members of namedtuples).
"""
- from collections import namedtuple
+ from collections import namedtuple # pylint: disable=import-outside-toplevel
class Crash(namedtuple("C", "foo bar")):
""" Looking for attributes in __str__ will crash,
diff --git a/tests/functional/s/string_formatting_py3.py b/tests/functional/s/string_formatting_py3.py
index c27e9719e..3cdd60eb2 100644
--- a/tests/functional/s/string_formatting_py3.py
+++ b/tests/functional/s/string_formatting_py3.py
@@ -17,5 +17,5 @@ def issue_957_bad2():
def issue_957_uninferable():
- from butchery import meat
+ from butchery import meat # pylint: disable=import-outside-toplevel
print('%s%s%s' % ('eggs', *meat))
diff --git a/tests/functional/u/unbalanced_tuple_unpacking.py b/tests/functional/u/unbalanced_tuple_unpacking.py
index d3887f4f3..ed807c0d7 100644
--- a/tests/functional/u/unbalanced_tuple_unpacking.py
+++ b/tests/functional/u/unbalanced_tuple_unpacking.py
@@ -2,7 +2,7 @@
from __future__ import absolute_import
from functional.u.unpacking import unpack
-# pylint: disable=using-constant-test, useless-object-inheritance
+# pylint: disable=using-constant-test, useless-object-inheritance,import-outside-toplevel
def do_stuff():
"""This is not right."""