Skip to content

Commit 85fa771

Browse files
committed
Add test case
1 parent 9020185 commit 85fa771

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/expressions/test_interpreter_coverage1.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,24 @@ def foo(self):
904904
interpreter.execute(tree)
905905
assert interpreter.get_name_value("result") == "A"
906906

907+
# Test class with super() in class level
908+
code = """
909+
class Base:
910+
x = 1
911+
912+
class Derived(Base):
913+
y = super().x + 1
914+
"""
915+
with pytest.raises(
916+
RuntimeError,
917+
match=(
918+
r"super\(\): no arguments and no context - unable to determine "
919+
r"class and instance"
920+
),
921+
):
922+
tree = parser.parse(code)
923+
interpreter.execute(tree)
924+
907925

908926
def test_visit_try():
909927
parser = ExpressionsParser()

0 commit comments

Comments
 (0)