summaryrefslogtreecommitdiff
path: root/Lib/test/test_compile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_compile.py')
-rw-r--r--Lib/test/test_compile.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index c0de3bef5b..fd1ef612fd 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -961,6 +961,32 @@ class TestExpressionStackSize(unittest.TestCase):
def test_binop(self):
self.check_stack_size("x + " * self.N + "x")
+ def test_list(self):
+ self.check_stack_size("[" + "x, " * self.N + "x]")
+
+ def test_tuple(self):
+ self.check_stack_size("(" + "x, " * self.N + "x)")
+
+ def test_set(self):
+ self.check_stack_size("{" + "x, " * self.N + "x}")
+
+ def test_dict(self):
+ self.check_stack_size("{" + "x:x, " * self.N + "x:x}")
+
+ def test_func_args(self):
+ self.check_stack_size("f(" + "x, " * self.N + ")")
+
+ def test_func_kwargs(self):
+ kwargs = (f'a{i}=x' for i in range(self.N))
+ self.check_stack_size("f(" + ", ".join(kwargs) + ")")
+
+ def test_func_args(self):
+ self.check_stack_size("o.m(" + "x, " * self.N + ")")
+
+ def test_meth_kwargs(self):
+ kwargs = (f'a{i}=x' for i in range(self.N))
+ self.check_stack_size("o.m(" + ", ".join(kwargs) + ")")
+
def test_func_and(self):
code = "def f(x):\n"
code += " x and x\n" * self.N