Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Augmented assignment on a list with a tuple value doesn't work #1865

Open
tristanlatr opened this issue Nov 10, 2022 · 1 comment
Open

Augmented assignment on a list with a tuple value doesn't work #1865

tristanlatr opened this issue Nov 10, 2022 · 1 comment
Labels
Enhancement ✨ Improvement to a component

Comments

@tristanlatr
Copy link
Contributor

Steps to reproduce

import astroid.helpers

def test_astroid_augmented_assigment_list_and_tuple() -> None:
    mod = astroid.parse('''
    l = []
    l += (1,2)
    ''')

    assignment, augmented_assigment = mod.getattr('l')
    assert astroid.helpers.safe_infer(augmented_assigment).as_string() == '[1,2]'
    # We get AssertionError: assert Uninferable == '[1,2]'

Current behavior

We get AssertionError: assert Uninferable == '[1,2]'

Expected behavior

The provided test should pass.
If one can point me to the right direction, I can try to provide a PR for the fix.

python -c "from astroid import __pkginfo__; print(__pkginfo__.version)" output

2.12.12

@Pierre-Sassoulas Pierre-Sassoulas added the Enhancement ✨ Improvement to a component label Nov 10, 2022
@DanielNoord
Copy link
Collaborator

This is probably part of the AugAssign path. Checking out infer_augassign might help, but I worry that this might be a difficult to fix bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

No branches or pull requests

3 participants