Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 26, 2023
1 parent 0ee6bcf commit 282b75c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions astroid/nodes/node_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,7 @@ def inferred_best(self) -> InferenceResult:
:rtype: InferenceResult
"""
return sorted(
self.infer(),
key=lambda inf: isinstance(inf, util.UninferableBase)
self.infer(), key=lambda inf: isinstance(inf, util.UninferableBase)
)[0]

def instantiate_class(self):
Expand Down
5 changes: 4 additions & 1 deletion tests/brain/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,10 @@ def pear(self):

# Test that both of the successfully inferred `Name` & `Attribute`
# nodes refer to the user-defined Enum class.
for inferred in (attribute_nodes[0].inferred_best(), name_nodes[0].inferred_best()):
for inferred in (
attribute_nodes[0].inferred_best(),
name_nodes[0].inferred_best(),
):
assert isinstance(inferred, astroid.Instance)
assert inferred.name == "Enum"
assert inferred.qname() == "module_with_class_named_enum.Enum"
Expand Down
1 change: 1 addition & 0 deletions tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -4511,6 +4511,7 @@ def test_inferred_best_any_value(self) -> None:
assert inferred_best is not util.Uninferable
assert inferred_best in inferred_all


class GetattrTest(unittest.TestCase):
def test_yes_when_unknown(self) -> None:
ast_nodes = extract_node(
Expand Down

0 comments on commit 282b75c

Please sign in to comment.