File tree Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Expand file tree Collapse file tree 2 files changed +3
-11
lines changed Original file line number Diff line number Diff line change 19
19
20
20
def _looks_like_parents_subscript (node : nodes .Subscript ) -> bool :
21
21
if not (
22
- isinstance (node .value , nodes .Name )
23
- or isinstance (node .value , nodes .Attribute )
24
- and node .value .attrname == "parents"
22
+ isinstance (node .value , nodes .Attribute ) and node .value .attrname == "parents"
25
23
):
26
24
return False
27
25
Original file line number Diff line number Diff line change @@ -28,20 +28,14 @@ def test_inference_parents() -> None:
28
28
29
29
def test_inference_parents_subscript_index () -> None :
30
30
"""Test inference of ``pathlib.Path.parents``, accessed by index."""
31
- parents , path = astroid .extract_node (
31
+ path = astroid .extract_node (
32
32
"""
33
33
from pathlib import Path
34
34
35
35
current_path = Path().resolve()
36
- path_parents = current_path.parents
37
- path_parents #@
38
- path_parents[2] #@
36
+ current_path.parents[2] #@
39
37
"""
40
38
)
41
- inferred = parents .inferred ()
42
- assert len (inferred ) == 1
43
- assert isinstance (inferred [0 ], bases .Instance )
44
- assert inferred [0 ].qname () == "pathlib._PathParents"
45
39
46
40
inferred = path .inferred ()
47
41
assert len (inferred ) == 1
You can’t perform that action at this time.
0 commit comments