summaryrefslogtreecommitdiff
path: root/tests/unittest_manager.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_manager.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_manager.py')
-rw-r--r--tests/unittest_manager.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/unittest_manager.py b/tests/unittest_manager.py
index 2bed335b..b81513b1 100644
--- a/tests/unittest_manager.py
+++ b/tests/unittest_manager.py
@@ -32,7 +32,6 @@ import pkg_resources
import astroid
from astroid import manager, test_utils
-from astroid.const import BUILTINS
from astroid.exceptions import AstroidBuildingError, AstroidImportError
from . import resources
@@ -263,22 +262,22 @@ class AstroidManagerTest(
def test_ast_from_class(self):
ast = self.manager.ast_from_class(int)
self.assertEqual(ast.name, "int")
- self.assertEqual(ast.parent.frame().name, BUILTINS)
+ self.assertEqual(ast.parent.frame().name, "builtins")
ast = self.manager.ast_from_class(object)
self.assertEqual(ast.name, "object")
- self.assertEqual(ast.parent.frame().name, BUILTINS)
+ self.assertEqual(ast.parent.frame().name, "builtins")
self.assertIn("__setattr__", ast)
def test_ast_from_class_with_module(self):
"""check if the method works with the module name"""
ast = self.manager.ast_from_class(int, int.__module__)
self.assertEqual(ast.name, "int")
- self.assertEqual(ast.parent.frame().name, BUILTINS)
+ self.assertEqual(ast.parent.frame().name, "builtins")
ast = self.manager.ast_from_class(object, object.__module__)
self.assertEqual(ast.name, "object")
- self.assertEqual(ast.parent.frame().name, BUILTINS)
+ self.assertEqual(ast.parent.frame().name, "builtins")
self.assertIn("__setattr__", ast)
def test_ast_from_class_attr_error(self):
@@ -307,10 +306,10 @@ class BorgAstroidManagerTC(unittest.TestCase):
"""test that the AstroidManager is really a borg, i.e. that two different
instances has same cache"""
first_manager = manager.AstroidManager()
- built = first_manager.ast_from_module_name(BUILTINS)
+ built = first_manager.ast_from_module_name("builtins")
second_manager = manager.AstroidManager()
- second_built = second_manager.ast_from_module_name(BUILTINS)
+ second_built = second_manager.ast_from_module_name("builtins")
self.assertIs(built, second_built)