gristlabs / asttokens

Annotate Python AST trees with source text and token information
Apache License 2.0
172 stars 34 forks source link

DeprecationWarning: The 'astroid.node_classes' module is deprecated #100

Closed 2-5 closed 1 year ago

2-5 commented 2 years ago

asttokens 2.0.8 raises a DeprecationWarning in astroid-2.12.11:

import asttokens
source = "Robot('blue').walk(steps=10*n)"
atok = asttokens.ASTTokens(source, parse=True)

# ./lib/site-packages/astroid/node_classes.py:94: DeprecationWarning: 
# The 'astroid.node_classes' module is deprecated and will be replaced by
# 'astroid.nodes' in astroid 3.0.0

https://github.com/PyCQA/astroid/blob/7ed8c6db48faaab02eb57c94659aa54e5c9c3aa1/astroid/node_classes.py#L94-L98

By default Python doesn't show deprecation warnings. To see the warning the PYTHONWARNINGS=default env variable needs to be set or the above code run with python -Wd

https://docs.python.org/3/library/warnings.html#updating-code-for-new-versions-of-dependencies

heirecka commented 1 year ago

This is now an error with astroid >= 3

========================================================================= short test summary info ==========================================================================
FAILED tests/test_astroid.py::TestAstroid::test_complex_slice_and_parens - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_comprehensions - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture3 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture4 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture7 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture8 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fixture9 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_fstrings - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_mark_tokens_multiline - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_mark_tokens_simple - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_parens_around_func - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_print_function - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_slices - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_sys_modules - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_trailing_commas - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?
FAILED tests/test_astroid.py::TestAstroid::test_tuples - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'?Details</summary>

``` python3.10 -m pytest =========================================================================== test session starts ============================================================================ platform linux -- Python 3.10.13, pytest-7.4.2, pluggy-1.2.0 benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000) rootdir: /var/tmp/paludis/build/dev-python-asttokens-2.4.0/work/PYTHON_ABIS/3.10/asttokens-2.4.0 configfile: setup.cfg plugins: flaky-3.7.0, expect-1.1.0, dependency-0.5.1, benchmark-4.0.0, services-2.2.1, anyio-3.6.2, django-4.5.2, forked-1.6.0, subtests-0.11.0, xdist-3.3.1, pytest_httpserver-1.0.8, cov-4.1.0, requests-mock-1.11.0, flake8-1.1.1, mock-3.11.1, asyncio-0.21.1, mypy-plugins-3.0.0, trio-0.8.0, hypothesis-6.86.2, xprocess-0.23.0, regressions-2.5.0, typeguard-4.1.5, datadir-1.5.0, pytest_param_files-0.6.0, sphinx_pytest-0.2.0, timeout-2.2.0, Faker-19.10.0, pyfakefs-5.3.0 asyncio: mode=strict collected 116 items tests/test_astroid.py ..........FF..s.........FF..FFFF.FF....FF.F..FFF. [ 42%] tests/test_asttokens.py ....... [ 48%] tests/test_line_numbers.py ... [ 50%] tests/test_mark_tokens.py ................................................. [ 93%] tests/test_tokenless.py ... [ 95%] tests/test_util.py ..... [100%] ================================================================================= FAILURES ================================================================================= ________________________________________________________________ TestAstroid.test_complex_slice_and_parens _________________________________________________________________ self = def test_complex_slice_and_parens(self): source = 'f((x)[:, 0])' > self.create_mark_checker(source) tests/test_mark_tokens.py:624: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string=':', start=(1, 6), end=(1, 7), line='f((x)[:, 0])', index=6, startpos=6, endpos=7) last_token = Token(type=2, string='0', start=(1, 9), end=(1, 10), line='f((x)[:, 0])', index=8, startpos=9, endpos=10) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError _____________________________________________________________________ TestAstroid.test_comprehensions ______________________________________________________________________ self = def test_comprehensions(self): # See https://bitbucket.org/plas/thonny/issues/8/range-marker-doesnt-work-correctly-with for source in ( "[(key, val) for key, val in ast.iter_fields(node)]", "((key, val) for key, val in ast.iter_fields(node))", "{(key, val) for key, val in ast.iter_fields(node)}", "{key: val for key, val in ast.iter_fields(node)}", "[[c for c in key] for key, val in ast.iter_fields(node)]"): > self.create_mark_checker(source) tests/test_mark_tokens.py:396: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(1, 1), end=(1, 2), line='[(key, val) for key, val in ast.iter_fields(node)]', index=1, startpos=1, endpos=2) last_token = Token(type=54, string=')', start=(1, 10), end=(1, 11), line='[(key, val) for key, val in ast.iter_fields(node)]', index=5, startpos=10, endpos=11) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ________________________________________________________________________ TestAstroid.test_fixture3 _________________________________________________________________________ self = > def test_fixture3(self): self.verify_fixture_file('astroid/all.py') tests/test_mark_tokens.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:139: in verify_fixture_file m = self.create_mark_checker(source, verify=False) tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=3, string="'Aaa'", start=(9, 10), end=(9, 15), line="__all__ = 'Aaa', '_bla', 'name'\n", index=32, startpos=85, endpos=90) last_token = Token(type=3, string="'name'", start=(9, 25), end=(9, 31), line="__all__ = 'Aaa', '_bla', 'name'\n", index=36, startpos=100, endpos=106) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ________________________________________________________________________ TestAstroid.test_fixture4 _________________________________________________________________________ self = > def test_fixture4(self): self.verify_fixture_file('astroid/clientmodule_test.py') tests/test_mark_tokens.py:176: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:139: in verify_fixture_file m = self.create_mark_checker(source, verify=False) tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(8, 21), end=(8, 22), line=' __implements__ = (IFace,)\n', index=29, startpos=194, endpos=195) last_token = Token(type=54, string=')', start=(8, 28), end=(8, 29), line=' __implements__ = (IFace,)\n', index=32, startpos=201, endpos=202) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ________________________________________________________________________ TestAstroid.test_fixture7 _________________________________________________________________________ self = > def test_fixture7(self): self.verify_fixture_file('astroid/format.py') tests/test_mark_tokens.py:179: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:139: in verify_fixture_file m = self.create_mark_checker(source, verify=False) tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=1, string='aaaa', start=(26, 4), end=(26, 8), line=' aaaa,bbbb = 1,2\n', index=93, startpos=320, endpos=324) last_token = Token(type=1, string='bbbb', start=(26, 9), end=(26, 13), line=' aaaa,bbbb = 1,2\n', index=95, startpos=325, endpos=329) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ________________________________________________________________________ TestAstroid.test_fixture8 _________________________________________________________________________ self = > def test_fixture8(self): self.verify_fixture_file('astroid/module.py') tests/test_mark_tokens.py:180: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:139: in verify_fixture_file m = self.create_mark_checker(source, verify=False) tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(34, 15), end=(34, 16), line=' except (NameError, TypeError):\n', index=143, startpos=631, endpos=632) last_token = Token(type=54, string=')', start=(34, 36), end=(34, 37), line=' except (NameError, TypeError):\n', index=147, startpos=652, endpos=653) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ________________________________________________________________________ TestAstroid.test_fixture9 _________________________________________________________________________ self = > def test_fixture9(self): self.verify_fixture_file('astroid/module2.py') tests/test_mark_tokens.py:181: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:139: in verify_fixture_file m = self.create_mark_checker(source, verify=False) tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(58, 21), end=(58, 22), line=' __implements__ = (MyIFace, AnotherIFace)\n', index=183, startpos=620, endpos=621) last_token = Token(type=54, string=')', start=(58, 43), end=(58, 44), line=' __implements__ = (MyIFace, AnotherIFace)\n', index=187, startpos=642, endpos=643) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ________________________________________________________________________ TestAstroid.test_fstrings _________________________________________________________________________ self = def test_fstrings(self): for source in ( '(f"He said his name is {name!r}.",)', "f'{function(kwarg=24)}'", 'a = f"""result: {value:{width}.{precision}}"""', """[f"abc {a['x']} def"]""", "def t():\n return f'{function(kwarg=24)}'"): > self.create_mark_checker(source) tests/test_mark_tokens.py:316: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(1, 0), end=(1, 1), line='(f"He said his name is {name!r}.",)', index=0, startpos=0, endpos=1) last_token = Token(type=54, string=')', start=(1, 34), end=(1, 35), line='(f"He said his name is {name!r}.",)', index=3, startpos=34, endpos=35) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError __________________________________________________________________ TestAstroid.test_mark_tokens_multiline __________________________________________________________________ self = def test_mark_tokens_multiline(self): source = ( """( # line1 a, # line2 b + # line3 c + # line4 d # line5 )""") > m = self.create_mark_checker(source) tests/test_mark_tokens.py:117: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(1, 0), end=(1, 1), line='( # line1\n', index=0, startpos=0, endpos=1) last_token = Token(type=54, string=')', start=(6, 0), end=(6, 1), line=')', index=18, startpos=77, endpos=78) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ___________________________________________________________________ TestAstroid.test_mark_tokens_simple ____________________________________________________________________ self = def test_mark_tokens_simple(self): source = tools.read_fixture('astroid', 'module.py') > m = self.create_mark_checker(source) tests/test_mark_tokens.py:79: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(34, 15), end=(34, 16), line=' except (NameError, TypeError):\n', index=143, startpos=631, endpos=632) last_token = Token(type=54, string=')', start=(34, 36), end=(34, 37), line=' except (NameError, TypeError):\n', index=147, startpos=652, endpos=653) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ___________________________________________________________________ TestAstroid.test_parens_around_func ____________________________________________________________________ self = def test_parens_around_func(self): source = textwrap.dedent( ''' foo() (foo)() (lambda: 0)() (lambda: ())() (foo)((1)) (lambda: ())((2)) x = (obj.attribute.get_callback() or default_callback)() ''') > m = self.create_mark_checker(source) tests/test_mark_tokens.py:610: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(5, 9), end=(5, 10), line='(lambda: ())()\n', index=22, startpos=38, endpos=39) last_token = Token(type=54, string=')', start=(5, 10), end=(5, 11), line='(lambda: ())()\n', index=23, startpos=39, endpos=40) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError _____________________________________________________________________ TestAstroid.test_print_function ______________________________________________________________________ self = def test_print_function(self): # This testcase imports print as function (using from __future__). Check that we can parse it. # verify_all_nodes doesn't work on Python 2 because the print() call parsed in isolation # is viewed as a Print node since it doesn't see the future import source = tools.read_fixture('astroid/nonregr.py') > m = self.create_mark_checker(source, verify=six.PY3) tests/test_mark_tokens.py:278: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=1, string='i', start=(11, 18), end=(11, 19), line=' yield i, val\n', index=39, startpos=200, endpos=201) last_token = Token(type=1, string='val', start=(11, 21), end=(11, 24), line=' yield i, val\n', index=41, startpos=203, endpos=206) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError _________________________________________________________________________ TestAstroid.test_slices __________________________________________________________________________ self = def test_slices(self): # Make sure we don't fail on parsing slices of the form `foo[4:]`. source = "(foo.Area_Code, str(foo.Phone)[:3], str(foo.Phone)[3:], foo[:], bar[::2, :], bar2[:, ::2], [a[:]][::-1])" > m = self.create_mark_checker(source) tests/test_mark_tokens.py:239: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string=':', start=(1, 68), end=(1, 69), line='(foo.Area_Code, str(foo.Phone)[:3], str(foo.Phone)[3:], foo[:], bar[::2, :], bar2[:, ::2], [a[:]][::-1])', index=34, startpos=68, endpos=69) last_token = Token(type=2, string='2', start=(1, 70), end=(1, 71), line='(foo.Area_Code, str(foo.Phone)[:3], str(foo.Phone)[3:], foo[:], bar[::2, :], bar2[:, ::2], [a[:]][::-1])', index=36, startpos=70, endpos=71) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError _______________________________________________________________________ TestAstroid.test_sys_modules _______________________________________________________________________ self = def test_sys_modules(self): """ Verify all nodes on source files obtained from sys.modules. This can take a long time as there are many modules, so it only tests all modules if the environment variable ASTTOKENS_SLOW_TESTS has been set. """ from .test_astroid import AstroidTreeException modules = list(sys.modules.values()) if not os.environ.get('ASTTOKENS_SLOW_TESTS'): modules = modules[:20] start = time() for module in modules: # Don't let this test (which runs twice) take longer than 13 minutes # to avoid the travis build time limit of 30 minutes if time() - start > 13 * 60: break try: filename = inspect.getsourcefile(module) except Exception: # some modules raise weird errors continue if not filename: continue filename = os.path.abspath(filename) print(filename) try: with io.open(filename) as f: source = f.read() except OSError: continue if self.is_astroid_test and ( # Astroid fails with a syntax error if a type comment is on its own line re.search(r'^\s*# type: ', source, re.MULTILINE) ): print('Skipping', filename) continue try: > self.create_mark_checker(source) tests/test_mark_tokens.py:671: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(247, 34), end=(247, 35), line=" if not message.startswith(('#', 'import ')):\n", index=1130, startpos=7717, endpos=7718) last_token = Token(type=54, string=')', start=(247, 49), end=(247, 50), line=" if not message.startswith(('#', 'import ')):\n", index=1134, startpos=7732, endpos=7733) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError --------------------------------------------------------------------------- Captured stdout call --------------------------------------------------------------------------- /usr/lib/python3.10/importlib/_bootstrap.py _____________________________________________________________________ TestAstroid.test_trailing_commas _____________________________________________________________________ self = def test_trailing_commas(self): # Make sure we handle trailing commas on comma-separated structures (e.g. tuples, sets, etc.) for source in ( "(a,b,)", "[c,d,]", "{e,f,}", "{h:1,i:2,}"): > self.create_mark_checker(source) tests/test_mark_tokens.py:405: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=54, string='(', start=(1, 0), end=(1, 1), line='(a,b,)', index=0, startpos=0, endpos=1) last_token = Token(type=54, string=')', start=(1, 5), end=(1, 6), line='(a,b,)', index=5, startpos=5, endpos=6) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError _________________________________________________________________________ TestAstroid.test_tuples __________________________________________________________________________ self = def test_tuples(self): def get_tuples(code): m = self.create_mark_checker(code) return [m.atok.get_text(n) for n in m.all_nodes if n.__class__.__name__ == "Tuple"] > self.assertEqual(get_tuples("a,"), ["a,"]) tests/test_mark_tokens.py:412: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/test_mark_tokens.py:409: in get_tuples m = self.create_mark_checker(code) tests/test_mark_tokens.py:38: in create_mark_checker atok = self.create_asttokens(source) tests/test_astroid.py:42: in create_asttokens return ASTTokens(source, tree=tree) asttokens/asttokens.py:130: in __init__ self.mark_tokens(self._tree) asttokens/asttokens.py:142: in mark_tokens MarkTokens(self).visit_tree(root_node) asttokens/mark_tokens.py:61: in visit_tree util.visit_tree(node, self._visit_before_children, self._visit_after_children) asttokens/util.py:272: in visit_tree ret = postvisit(current, par_value, cast(Optional[Token], value)) asttokens/mark_tokens.py:109: in _visit_after_children nfirst, nlast = self._methods.get(self, node.__class__)(node, first, last) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , node = first_token = Token(type=1, string='a', start=(1, 0), end=(1, 1), line='a,', index=0, startpos=0, endpos=1) last_token = Token(type=1, string='a', start=(1, 0), end=(1, 1), line='a,', index=0, startpos=0, endpos=1) def visit_tuple(self, node, first_token, last_token): # type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token] > assert isinstance(node, ast.Tuple) or isinstance(node, nc._BaseContainer) E AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? asttokens/mark_tokens.py:334: AttributeError ========================================================================= short test summary info ========================================================================== FAILED tests/test_astroid.py::TestAstroid::test_complex_slice_and_parens - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_comprehensions - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_fixture3 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_fixture4 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_fixture7 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_fixture8 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_fixture9 - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_fstrings - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_mark_tokens_multiline - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_mark_tokens_simple - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_parens_around_func - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_print_function - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_slices - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_sys_modules - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_trailing_commas - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? FAILED tests/test_astroid.py::TestAstroid::test_tuples - AttributeError: module 'astroid.nodes' has no attribute '_BaseContainer'. Did you mean: 'BaseContainer'? ================================================================= 16 failed, 99 passed, 1 skipped in 5.69s ================================================================= ```

alexmojaki commented 1 year ago

module 'astroid.nodes' has no attribute '_BaseContainer' is because _BaseContainer got renamed, not because of using astroid.node_classes.

PR welcome to add _BaseContainer / BaseContainer to astroid_compat.py.

PeterJCLaw commented 1 year ago

After the rename of _BaseContainer, there's three tests which still fail. One looks like a count of the nodes touched, which has a comment that the exact number isn't important, so that's easy to fix.

The others look like they're a result of a change in behaviour:

____________________ TestAstroid.test_fixture9 ____________________

self = <tests.test_astroid.TestAstroid testMethod=test_fixture9>

>   def test_fixture9(self): self.verify_fixture_file('astroid/module2.py')

tests/test_mark_tokens.py:181: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_mark_tokens.py:140: in verify_fixture_file
    tested_nodes = m.verify_all_nodes(self)
tests/tools.py:89: in verify_all_nodes
    self.check_get_text_tokenless(node, test_case, text)
tests/tools.py:160: in check_get_text_tokenless
    test_case.assertEqual(text, text_tokenless)
E   AssertionError: 'class Aaaa(base):' != '    class Aaaa(base):\n        """dynamic class"""'
E   - class Aaaa(base):
E   +     class Aaaa(base):
E           """dynamic class"""

@alexmojaki what's the expected outcome here -- is this the sort of thing where you'd update the test expectation, or does this imply that code changes are needed to preserve the previous behaviour? (I haven't yet looked much into what the test actually does).

PeterJCLaw commented 1 year ago

Nevermind, I think I have fixes (somewhat accidentally) from fixing some of the warnings.

alexmojaki commented 1 year ago

Released 2.4.1