Skip to content

Commit b8ad876

Browse files
[tests] Simplify _locals test so it's easier to see what's wrong
We're going to do a full check later, if the test fail it's better to see the different of the locals' name that a different number.
1 parent e7a8669 commit b8ad876

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tests/test_builder.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,7 @@ def test_function_base_props(self) -> None:
781781
def test_function_locals(self) -> None:
782782
"""Test the 'locals' dictionary of an astroid function."""
783783
_locals = self.module["global_access"].locals
784-
self.assertEqual(len(_locals), 4)
785-
keys = sorted(_locals.keys())
786-
self.assertEqual(keys, ["i", "key", "local", "val"])
784+
self.assertEqual(sorted(_locals.keys()), ["i", "key", "local", "val"])
787785

788786
def test_class_base_props(self) -> None:
789787
"""Test base properties and method of an astroid class."""
@@ -861,11 +859,8 @@ def test_method_base_props(self) -> None:
861859
def test_method_locals(self) -> None:
862860
"""Test the 'locals' dictionary of an astroid method."""
863861
method = self.module["YOUPI"]["method"]
864-
_locals = method.locals
865-
keys = sorted(_locals)
866862
# ListComp variables are not accessible outside
867-
self.assertEqual(len(_locals), 3)
868-
self.assertEqual(keys, ["autre", "local", "self"])
863+
self.assertEqual(sorted(method.locals), ["autre", "local", "self"])
869864

870865
def test_unknown_encoding(self) -> None:
871866
with self.assertRaises(AstroidSyntaxError):

0 commit comments

Comments
 (0)