summaryrefslogtreecommitdiff
path: root/tests/unittest_scoped_nodes.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-08-18 23:04:14 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-08-18 23:17:45 +0200
commit44fc1e1e23fd1d3b43cf80a10eb1c032a4312a2b (patch)
tree5c6c2ad5028be821b72fdbda71160fe22b93f0e3 /tests/unittest_scoped_nodes.py
parent76036144e4b0049575d5c2f0c64d6365529ee9e7 (diff)
downloadastroid-git-builtin-simplified.tar.gz
Replace the constant BUILTINS by the string 'builtins'builtin-simplified
This make for clearer and also sligtly faster code (means time seems to decrese by 0.68% with this change alone (astroid/pylint) in the pylint tests benchmarks). Done because we were using an import from astroid from astroid.bases for one of those, which is kinda messy.
Diffstat (limited to 'tests/unittest_scoped_nodes.py')
-rw-r--r--tests/unittest_scoped_nodes.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/unittest_scoped_nodes.py b/tests/unittest_scoped_nodes.py
index 2a5bf5da..bbb7cbee 100644
--- a/tests/unittest_scoped_nodes.py
+++ b/tests/unittest_scoped_nodes.py
@@ -41,7 +41,7 @@ from functools import partial
import pytest
from astroid import MANAGER, builder, nodes, objects, test_utils, util
-from astroid.bases import BUILTINS, BoundMethod, Generator, Instance, UnboundMethod
+from astroid.bases import BoundMethod, Generator, Instance, UnboundMethod
from astroid.exceptions import (
AttributeInferenceError,
DuplicateBasesError,
@@ -368,7 +368,7 @@ class FunctionNodeTest(ModuleLoader, unittest.TestCase):
method = self.module2["AbstractClass"]["to_override"]
self.assertTrue(method.is_abstract(pass_is_abstract=False))
self.assertEqual(method.qname(), "data.module2.AbstractClass.to_override")
- self.assertEqual(method.pytype(), "%s.instancemethod" % BUILTINS)
+ self.assertEqual(method.pytype(), "builtins.instancemethod")
method = self.module2["AbstractClass"]["return_something"]
self.assertFalse(method.is_abstract(pass_is_abstract=False))
# non regression : test raise "string" doesn't cause an exception in is_abstract
@@ -417,7 +417,7 @@ class FunctionNodeTest(ModuleLoader, unittest.TestCase):
"""
astroid = builder.parse(data)
g = list(astroid["f"].ilookup("g"))[0]
- self.assertEqual(g.pytype(), "%s.function" % BUILTINS)
+ self.assertEqual(g.pytype(), "builtins.function")
def test_lambda_qname(self):
astroid = builder.parse("lmbd = lambda: None", __name__)
@@ -1391,7 +1391,7 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase):
A1 = astroid.getattr("A1")[0]
B1 = astroid.getattr("B1")[0]
C1 = astroid.getattr("C1")[0]
- object_ = MANAGER.astroid_cache[BUILTINS].getattr("object")[0]
+ object_ = MANAGER.astroid_cache["builtins"].getattr("object")[0]
self.assertEqual(
cm.exception.mros, [[B1, C1, A1, object_], [C1, B1, A1, object_]]
)