Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf9ca546

Browse files
committed
Add test
1 parent83c4717 commitf9ca546

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎Lib/test/test_compile.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,19 @@ def continue_in_while():
846846
self.assertEqual(None,opcodes[1].argval)
847847
self.assertEqual('RETURN_VALUE',opcodes[2].opname)
848848

849+
deftest_unloop_break_continue(self):
850+
source_template="with object() as obj:\n {}"
851+
sources= []
852+
forstmtin ('break','continue'):
853+
sources.append((stmt,source_template.format(stmt)))
854+
855+
forstmt,sourceinsources:
856+
withself.subTest(stmt=stmt):
857+
withself.assertRaises(SyntaxError)aserr_ctx:
858+
compile(source,f"<unloop_{stmt}>","exec")
859+
exc=err_ctx.exception
860+
self.assertEqual(exc.lineno,2)
861+
849862
deftest_consts_in_conditionals(self):
850863
defand_true(x):
851864
returnTrueandx

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp