MCPcopy Index your code
hub / github.com/python/cpython / test_break_outside_loop

Method test_break_outside_loop

Lib/test/test_syntax.py:3076–3086  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3074 "outside function")
3075
3076 def test_break_outside_loop(self):
3077 msg = "outside loop"
3078 self._check_error("break", msg, lineno=1)
3079 self._check_error("if 0: break", msg, lineno=1)
3080 self._check_error("if 0: break\nelse: x=1", msg, lineno=1)
3081 self._check_error("if 1: pass\nelse: break", msg, lineno=2)
3082 self._check_error("class C:\n if 0: break", msg, lineno=2)
3083 self._check_error("class C:\n if 1: pass\n else: break",
3084 msg, lineno=3)
3085 self._check_error("with object() as obj:\n break",
3086 msg, lineno=2)
3087
3088 def test_continue_outside_loop(self):
3089 msg = "not properly in loop"

Callers

nothing calls this directly

Calls 1

_check_errorMethod · 0.95

Tested by

no test coverage detected