Skip to content

Commit db54ed2

Browse files
committed
use non-constants
1 parent 611de40 commit db54ed2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/test_type_annotations.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,12 @@ class format: pass
462462
class ConditionalAnnotationTests(unittest.TestCase):
463463
def check_scopes(self, code, true_annos, false_annos):
464464
for scope in ("class", "module"):
465-
for (cond, expected) in ((True, true_annos), (False, false_annos)):
465+
for (cond, expected) in (
466+
# Constants (so code might get optimized out)
467+
(True, true_annos), (False, false_annos),
468+
# Non-constant expressions
469+
("not not len", true_annos), ("not len", false_annos),
470+
):
466471
with self.subTest(scope=scope, cond=cond):
467472
code_to_run = code.format(cond=cond)
468473
if scope == "class":

0 commit comments

Comments
 (0)