diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-05 09:08:14 +0100 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-05 09:41:16 +0100 |
| commit | 0a8a75db30da060a24922e05048bc270230f5bad (patch) | |
| tree | 5ab4b277a46ba707fe379db6b737ad9b12270694 /tests/unittest_inference.py | |
| parent | 01b5b572149f19550d4fdec3fd7d1e40aee9b624 (diff) | |
| download | astroid-git-0a8a75db30da060a24922e05048bc270230f5bad.tar.gz | |
Reverse the order of decorators for `infer_subscript`
`path_wrapper` needs to come first, followed by `raise_if_nothing_inferred`,
otherwise we won't handle `StopIteration` correctly.
Close #762
Diffstat (limited to 'tests/unittest_inference.py')
| -rw-r--r-- | tests/unittest_inference.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 91a14ec6..ec396f8a 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -5646,5 +5646,26 @@ def test_custom_decorators_for_classmethod_and_staticmethods(code, obj, obj_type assert inferred.type == obj_type +@pytest.mark.skipif(sys.version_info < (3, 8), reason="Needs dataclasses available") +def test_dataclasses_subscript_inference_recursion_error(): + code = """ + from dataclasses import dataclass, replace + + @dataclass + class ProxyConfig: + auth: str = "/auth" + + + a = ProxyConfig("") + test_dict = {"proxy" : {"auth" : "", "bla" : "f"}} + + foo = test_dict['proxy'] + replace(a, **test_dict['proxy']) # This fails + """ + node = extract_node(code) + # Reproduces only with safe_infer() + assert helpers.safe_infer(node) is None + + if __name__ == "__main__": unittest.main() |
