diff options
| author | hippo91 <guillaume.peillex@gmail.com> | 2020-12-13 15:28:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-13 15:28:13 +0100 |
| commit | 8ad83812e76d7d69249198beb4e18d9805e2d782 (patch) | |
| tree | 94dadcaf799072eec65fbe01f434c91eaa07484e /tests | |
| parent | 969a5cf119bbaa37b9700e83491d1639da6cbe55 (diff) | |
| parent | a35ff5452849fe08f95e76b6714df282eac0abc6 (diff) | |
| download | astroid-git-8ad83812e76d7d69249198beb4e18d9805e2d782.tar.gz | |
Merge pull request #858 from hippo91/fix_python39_new
Fix python39
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unittest_inference.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/unittest_inference.py b/tests/unittest_inference.py index 23a131e4..c378258a 100644 --- a/tests/unittest_inference.py +++ b/tests/unittest_inference.py @@ -5655,6 +5655,10 @@ def test_custom_decorators_for_classmethod_and_staticmethods(code, obj, obj_type @pytest.mark.skipif(sys.version_info < (3, 8), reason="Needs dataclasses available") +@pytest.mark.skipif( + sys.version_info >= (3, 9), + reason="Exact inference with dataclasses (replace function) in python3.9", +) def test_dataclasses_subscript_inference_recursion_error(): code = """ from dataclasses import dataclass, replace @@ -5675,6 +5679,31 @@ def test_dataclasses_subscript_inference_recursion_error(): assert helpers.safe_infer(node) is None +@pytest.mark.skipif( + sys.version_info < (3, 9), + reason="Exact inference with dataclasses (replace function) in python3.9", +) +def test_dataclasses_subscript_inference_recursion_error_39(): + 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) + infer_val = helpers.safe_infer(node) + assert isinstance(infer_val, Instance) + assert infer_val.pytype() == ".ProxyConfig" + + def test_self_reference_infer_does_not_trigger_recursion_error(): # Prevents https://github.com/PyCQA/pylint/issues/1285 code = """ |
