MCPcopy Create free account
hub / github.com/SplootCode/splootcode / testBreak

Method testBreak

python/tests/test_execute.py:243–271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

241 self.assertEqual(f.read(), '2.0\n2\n')
242
243 def testBreak(self):
244 splootFile = splootFromPython('''
245x = 10
246while x > 0:
247 x = x - 1
248 if x == 8:
249 print('continuing')
250 continue
251 print(x)
252 if x == 5:
253 print('breaking')
254 break
255print('hi')
256''')
257
258 f = io.StringIO()
259 f.write = wrapStdout(f.write)
260 with contextlib.redirect_stdout(f):
261 executePythonFile(splootFile)
262
263 f.seek(0)
264 self.assertEqual(f.read(), '''9
265continuing
2667
2676
2685
269breaking
270hi
271''')
272
273 def testDict(self):
274 splootFile = splootFromPython('''d = {"hello": "hallo"}

Callers

nothing calls this directly

Calls 4

splootFromPythonFunction · 0.90
wrapStdoutFunction · 0.90
executePythonFileFunction · 0.90
readMethod · 0.80

Tested by

no test coverage detected