MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / test_parsing

Function test_parsing

tests/test_check_object.py:265–345  ·  view source on GitHub ↗
(name, ls, le, cs, ce)

Source from the content-addressed store, hash-verified

263 ],
264)
265def test_parsing(name, ls, le, cs, ce):
266 stu_code = """
267if True:
268 a = 1
269
270if False:
271 b = 2
272else:
273 c = 3
274
275for i in range(2):
276 d = 4
277
278x = 2
279while x > 0:
280 e = 5
281 x -= 1
282
283try:
284 f = 6
285except:
286 pass
287
288try:
289 g = 7
290except:
291 pass
292finally:
293 h = 8
294
295# 2 assignments
296i = 9
297if True:
298 i = 9
299"""
300 sol_code = """
301if True:
302 a = 10
303
304if False:
305 b = 20
306else:
307 c = 30
308
309for i in range(2):
310 d = 40
311
312x = 2
313while x > 0:
314 e = 50
315 x -= 1
316
317try:
318 f = 60
319except:
320 pass
321
322try:

Callers

nothing calls this directly

Calls 1

runMethod · 0.80

Tested by

no test coverage detected