diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-08-18 23:04:14 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-08-18 23:17:45 +0200 |
commit | 44fc1e1e23fd1d3b43cf80a10eb1c032a4312a2b (patch) | |
tree | 5c6c2ad5028be821b72fdbda71160fe22b93f0e3 /tests/unittest_nodes.py | |
parent | 76036144e4b0049575d5c2f0c64d6365529ee9e7 (diff) | |
download | astroid-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_nodes.py')
-rw-r--r-- | tests/unittest_nodes.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py index a89bc679..b682cfd8 100644 --- a/tests/unittest_nodes.py +++ b/tests/unittest_nodes.py @@ -40,7 +40,7 @@ import astroid from astroid import Uninferable, bases, builder from astroid import context as contextmod from astroid import nodes, parse, test_utils, transforms, util -from astroid.const import BUILTINS, PY38_PLUS, PY310_PLUS, Context +from astroid.const import PY38_PLUS, PY310_PLUS, Context from astroid.exceptions import ( AstroidBuildingError, AstroidSyntaxError, @@ -473,18 +473,18 @@ class ImportNodeTest(resources.SysPathSetup, unittest.TestCase): self.assertTrue(isinstance(myos, nodes.Module), myos) self.assertEqual(myos.name, "os") self.assertEqual(myos.qname(), "os") - self.assertEqual(myos.pytype(), "%s.module" % BUILTINS) + self.assertEqual(myos.pytype(), "builtins.module") def test_from_self_resolve(self): namenode = next(self.module.igetattr("NameNode")) self.assertTrue(isinstance(namenode, nodes.ClassDef), namenode) self.assertEqual(namenode.root().name, "astroid.nodes.node_classes") self.assertEqual(namenode.qname(), "astroid.nodes.node_classes.Name") - self.assertEqual(namenode.pytype(), "%s.type" % BUILTINS) + self.assertEqual(namenode.pytype(), "builtins.type") abspath = next(self.module2.igetattr("abspath")) self.assertTrue(isinstance(abspath, nodes.FunctionDef), abspath) self.assertEqual(abspath.root().name, "os.path") - self.assertEqual(abspath.pytype(), "%s.function" % BUILTINS) + self.assertEqual(abspath.pytype(), "builtins.function") if sys.platform != "win32": # Not sure what is causing this check to fail on Windows. # For some reason the abspath() inference returns a different |