diff options
author | Bryce Guinta <bryce.guinta@protonmail.com> | 2020-06-22 02:22:16 -0400 |
---|---|---|
committer | Bryce Guinta <bryce.guinta@protonmail.com> | 2020-06-23 22:16:21 -0400 |
commit | 25384d4bebf0187b6704c818c7df64945793362c (patch) | |
tree | da56f7e09c07a735294f6c36141aecfb72356c64 /tests/unittest_brain.py | |
parent | ec96745c0fdb9432549d182e381164d1836e8a4b (diff) | |
download | astroid-git-25384d4bebf0187b6704c818c7df64945793362c.tar.gz |
Squash one-off inference utility functions to help reduce recursion errors (#804)
This also makes debugging a lot simpler reducing the complexity of the
function stack.
Diffstat (limited to 'tests/unittest_brain.py')
-rw-r--r-- | tests/unittest_brain.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/unittest_brain.py b/tests/unittest_brain.py index 25e2bb5b..c308ddd5 100644 --- a/tests/unittest_brain.py +++ b/tests/unittest_brain.py @@ -2035,5 +2035,21 @@ def test_str_and_bytes(code, expected_class, expected_value): assert inferred.value == expected_value +def test_no_recursionerror_on_self_referential_length_check(): + """ + Regression test for https://github.com/PyCQA/astroid/issues/777 + """ + with pytest.raises(astroid.InferenceError): + node = astroid.extract_node( + """ + class Crash: + def __len__(self) -> int: + return len(self) + len(Crash()) #@ + """ + ) + node.inferred() + + if __name__ == "__main__": unittest.main() |