summaryrefslogtreecommitdiff
path: root/astroid/tests
diff options
context:
space:
mode:
Diffstat (limited to 'astroid/tests')
-rw-r--r--astroid/tests/unittest_brain.py1
-rw-r--r--astroid/tests/unittest_builder.py6
-rw-r--r--astroid/tests/unittest_inference.py35
-rw-r--r--astroid/tests/unittest_scoped_nodes.py15
4 files changed, 26 insertions, 31 deletions
diff --git a/astroid/tests/unittest_brain.py b/astroid/tests/unittest_brain.py
index 228d705..21b4265 100644
--- a/astroid/tests/unittest_brain.py
+++ b/astroid/tests/unittest_brain.py
@@ -108,7 +108,6 @@ class NamedTupleTest(unittest.TestCase):
""")
self.assertIs(bases.YES, next(klass.infer()))
-
@unittest.skipIf(sys.version_info[0] > 2,
'namedtuple inference is broken on Python 3')
def test_namedtuple_advanced_inference(self):
diff --git a/astroid/tests/unittest_builder.py b/astroid/tests/unittest_builder.py
index 3df9d36..14ce5be 100644
--- a/astroid/tests/unittest_builder.py
+++ b/astroid/tests/unittest_builder.py
@@ -604,8 +604,8 @@ class FileBuildTest(unittest.TestCase):
self.assertIs(_locals, module.globals)
keys = sorted(_locals.keys())
should = ['MY_DICT', 'YO', 'YOUPI',
- '__revision__', 'global_access', 'modutils', 'four_args',
- 'os', 'redirect', 'pb', 'LocalsVisitor', 'ASTWalker']
+ '__revision__', 'global_access', 'modutils', 'four_args',
+ 'os', 'redirect', 'pb', 'LocalsVisitor', 'ASTWalker']
should.sort()
self.assertEqual(keys, should)
@@ -659,7 +659,7 @@ class FileBuildTest(unittest.TestCase):
keys = locals2.keys()
self.assertEqual(sorted(keys),
['__init__', 'class_attr', 'class_method',
- 'method', 'static_method'])
+ 'method', 'static_method'])
def test_class_instance_attrs(self):
module = self.module
diff --git a/astroid/tests/unittest_inference.py b/astroid/tests/unittest_inference.py
index 230279f..c2c3889 100644
--- a/astroid/tests/unittest_inference.py
+++ b/astroid/tests/unittest_inference.py
@@ -620,8 +620,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
fct(a_line)
'''
ast = test_utils.build_module(code, __name__)
- self.assertEqual(len(list(ast['process_line'].infer_call_result(
- None))), 3)
+ self.assertEqual(len(list(ast['process_line'].infer_call_result(None))), 3)
self.assertEqual(len(list(ast['tupletest'].infer())), 3)
values = ['Function(first_word)', 'Function(last_word)', 'Const(NoneType)']
self.assertEqual([str(infered)
@@ -657,8 +656,8 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
return something.conjugate()
'''
ast = test_utils.build_module(code, __name__)
- self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'something', -1).infer()], [1.0, 1.0j])
+ values = [i.value for i in test_utils.get_name_node(ast, 'something', -1).infer()]
+ self.assertEqual(values, [1.0, 1.0j])
def test_simple_subscript(self):
@@ -674,13 +673,13 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
'''
ast = test_utils.build_module(code, __name__)
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'a', -1).infer()], [1])
+ test_utils.get_name_node(ast, 'a', -1).infer()], [1])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'b', -1).infer()], [2])
+ test_utils.get_name_node(ast, 'b', -1).infer()], [2])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'c', -1).infer()], [3])
+ test_utils.get_name_node(ast, 'c', -1).infer()], [3])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'd', -1).infer()], [6])
+ test_utils.get_name_node(ast, 'd', -1).infer()], [6])
self.assertEqual([i.value for i in
test_utils.get_name_node(ast, 'f', -1).infer()], ['value'])
@@ -707,16 +706,15 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
'''
ast = test_utils.build_module(code, __name__)
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'a', -1).infer()], [1, 2, 3])
+ test_utils.get_name_node(ast, 'a', -1).infer()], [1, 2, 3])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'b', -1).infer()], [1, 3])
+ test_utils.get_name_node(ast, 'b', -1).infer()], [1, 3])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'c', -1).infer()], [2, 4])
+ test_utils.get_name_node(ast, 'c', -1).infer()], [2, 4])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'd', -1).infer()], [2, 4])
+ test_utils.get_name_node(ast, 'd', -1).infer()], [2, 4])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'e', -1).infer()], [1, 3])
-
+ test_utils.get_name_node(ast, 'e', -1).infer()], [1, 3])
def test_simple_for_genexpr(self):
code = '''
@@ -724,9 +722,9 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
'''
ast = test_utils.build_module(code, __name__)
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'd', -1).infer()], [2, 4])
+ test_utils.get_name_node(ast, 'd', -1).infer()], [2, 4])
self.assertEqual([i.value for i in
- test_utils.get_name_node(ast, 'e', -1).infer()], [1, 3])
+ test_utils.get_name_node(ast, 'e', -1).infer()], [1, 3])
def test_builtin_help(self):
@@ -1067,7 +1065,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
decorators = set(['%s.property' % BUILTINS])
ast = test_utils.build_module(code, __name__)
self.assertEqual(ast['SendMailController']['smtp'].decoratornames(),
- decorators)
+ decorators)
propinfered = list(ast.body[2].value.infer())
self.assertEqual(len(propinfered), 1)
propinfered = propinfered[0]
@@ -1075,7 +1073,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
self.assertEqual(propinfered.name, 'SMTP')
self.assertEqual(propinfered.root().name, 'smtplib')
self.assertEqual(ast['SendMailController']['me'].decoratornames(),
- decorators)
+ decorators)
propinfered = list(ast.body[3].value.infer())
self.assertEqual(len(propinfered), 1)
propinfered = propinfered[0]
@@ -1083,7 +1081,6 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
self.assertEqual(propinfered.name, 'SendMailController')
self.assertEqual(propinfered.root().name, __name__)
-
def test_im_func_unwrap(self):
code = '''
class EnvBasedTC:
diff --git a/astroid/tests/unittest_scoped_nodes.py b/astroid/tests/unittest_scoped_nodes.py
index 2d37589..e61f427 100644
--- a/astroid/tests/unittest_scoped_nodes.py
+++ b/astroid/tests/unittest_scoped_nodes.py
@@ -26,9 +26,9 @@ import warnings
from astroid import YES, builder, nodes, scoped_nodes
from astroid.exceptions import (
- InferenceError, NotFoundError,
- NoDefault, ResolveError, MroError,
- InconsistentMroError, DuplicateBasesError,
+ InferenceError, NotFoundError,
+ NoDefault, ResolveError, MroError,
+ InconsistentMroError, DuplicateBasesError,
)
from astroid.bases import (
BUILTINS, Instance,
@@ -132,7 +132,7 @@ class ModuleNodeTest(ModuleLoader, unittest.TestCase):
astroid = test_utils.build_module(data, __name__)
# test del statement not returned by getattr
self.assertEqual(len(astroid.getattr('appli')), 2,
- astroid.getattr('appli'))
+ astroid.getattr('appli'))
def test_relative_to_absolute_name(self):
# package
@@ -725,7 +725,7 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase):
('Concrete23', ['MyIFace', 'AnotherIFace'])):
klass = self.module2[klass]
self.assertEqual([i.name for i in klass.interfaces()],
- interfaces)
+ interfaces)
def test_concat_interfaces(self):
astroid = test_utils.build_module('''
@@ -744,7 +744,7 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase):
__implements__ = BadArgument.__implements__ + Correct2.__implements__
''')
self.assertEqual([i.name for i in astroid['InterfaceCanNowBeFound'].interfaces()],
- ['IMachin'])
+ ['IMachin'])
def test_inner_classes(self):
eee = self.nonregr['Ccc']['Eee']
@@ -764,8 +764,7 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase):
astroid = test_utils.build_module(data, __name__)
cls = astroid['WebAppObject']
self.assertEqual(sorted(cls.locals.keys()),
- ['appli', 'config', 'registered', 'schema'])
-
+ ['appli', 'config', 'registered', 'schema'])
def test_class_getattr(self):
data = '''