diff --git a/test/test_evaluate/test_representation.py b/test/test_evaluate/test_representation.py index 8d6dd91e..80b4771e 100644 --- a/test/test_evaluate/test_representation.py +++ b/test/test_evaluate/test_representation.py @@ -1,6 +1,13 @@ +from textwrap import dedent + from jedi import Script +def get_definition_and_evaluator(source): + d = Script(dedent(source)).goto_definitions()[0] + return d._definition, d._evaluator + + def test_function_execution(): """ We've been having an issue of a mutable list that was changed inside the @@ -11,10 +18,19 @@ def test_function_execution(): def x(): return str() x""" - d = Script(s).goto_definitions()[0] + func, evaluator = get_definition_and_evaluator(s) # Now just use the internals of the result (easiest way to get a fully # usable function). - func, evaluator = d._definition, d._evaluator # Should return the same result both times. assert len(evaluator.execute(func)) == 1 assert len(evaluator.execute(func)) == 1 + + +def test_class_mro(): + s = """ + class X(object): + pass + X""" + cls, evaluator = get_definition_and_evaluator(s) + mro = cls.py__mro__(evaluator) + assert [str(c.name) for c in mro] == ['X', 'object']