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_brain.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_brain.py')
-rw-r--r-- | tests/unittest_brain.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index e358eda5..34a4b43a 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -695,7 +695,7 @@ class MultiprocessingBrainTest(unittest.TestCase): for attr in ("list", "dict"): obj = next(module[attr].infer()) - self.assertEqual(obj.qname(), f"{bases.BUILTINS}.{attr}") + self.assertEqual(obj.qname(), f"builtins.{attr}") # pypy's implementation of array.__spec__ return None. This causes problems for this inference. if not hasattr(sys, "pypy_version_info"): @@ -771,10 +771,9 @@ class EnumBrainTest(unittest.TestCase): one = enumeration["one"] self.assertEqual(one.pytype(), ".MyEnum.one") - property_type = f"{bases.BUILTINS}.property" for propname in ("name", "value"): prop = next(iter(one.getattr(propname))) - self.assertIn(property_type, prop.decoratornames()) + self.assertIn("builtins.property", prop.decoratornames()) meth = one.getattr("mymethod")[0] self.assertIsInstance(meth, astroid.FunctionDef) @@ -861,9 +860,8 @@ class EnumBrainTest(unittest.TestCase): one = enumeration["one"] clazz = one.getattr("__class__")[0] - int_type = f"{bases.BUILTINS}.int" self.assertTrue( - clazz.is_subtype_of(int_type), + clazz.is_subtype_of("builtins.int"), "IntEnum based enums should be a subtype of int", ) |