From 282b75c43372e5e9f48348ca798c0a78a27b6054 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:31:58 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- astroid/nodes/node_ng.py | 3 +-- tests/brain/test_enum.py | 5 ++++- tests/test_inference.py | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/astroid/nodes/node_ng.py b/astroid/nodes/node_ng.py index 00d7a14448..d322e35775 100644 --- a/astroid/nodes/node_ng.py +++ b/astroid/nodes/node_ng.py @@ -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): diff --git a/tests/brain/test_enum.py b/tests/brain/test_enum.py index 14ff15406e..3d59f3f9b7 100644 --- a/tests/brain/test_enum.py +++ b/tests/brain/test_enum.py @@ -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" diff --git a/tests/test_inference.py b/tests/test_inference.py index f3b76b0063..1468dc55cb 100644 --- a/tests/test_inference.py +++ b/tests/test_inference.py @@ -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(