MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / test_evaluate_block_repl

Function test_evaluate_block_repl

tests_python/test_debugger_json.py:2377–2412  ·  view source on GitHub ↗
(case_setup_dap)

Source from the content-addressed store, hash-verified

2375
2376
2377def test_evaluate_block_repl(case_setup_dap):
2378 with case_setup_dap.test_file("_debugger_case_local_variables2.py") as writer:
2379 json_facade = JsonFacade(writer)
2380
2381 writer.write_add_breakpoint(writer.get_line_index_with_content("Break here"))
2382 json_facade.write_make_initial_run()
2383
2384 json_hit = json_facade.wait_for_thread_stopped()
2385 json_hit = json_facade.get_stack_as_json_hit(json_hit.thread_id)
2386
2387 # Check eval with a properly indented block
2388 json_facade.evaluate(
2389 "for i in range(2):\n print('var%s' % i)",
2390 frameId=json_hit.frame_id,
2391 context="repl",
2392 )
2393
2394 messages = json_facade.mark_messages(OutputEvent, lambda output_event: "var0" in output_event.body.output)
2395 assert len(messages) == 1
2396 messages = json_facade.mark_messages(OutputEvent, lambda output_event: "var1" in output_event.body.output)
2397 assert len(messages) == 1
2398
2399 # Check eval with a block that needs to be dedented
2400 json_facade.evaluate(
2401 " for i in range(2):\n print('foo%s' % i)",
2402 frameId=json_hit.frame_id,
2403 context="repl",
2404 )
2405
2406 messages = json_facade.mark_messages(OutputEvent, lambda output_event: "foo0" in output_event.body.output)
2407 assert len(messages) == 1
2408 messages = json_facade.mark_messages(OutputEvent, lambda output_event: "foo1" in output_event.body.output)
2409 assert len(messages) == 1
2410
2411 json_facade.write_continue()
2412 writer.finished_ok = True
2413
2414
2415def test_evaluate_block_clipboard(case_setup_dap, pyfile):

Callers

nothing calls this directly

Calls 10

get_stack_as_json_hitMethod · 0.95
evaluateMethod · 0.95
mark_messagesMethod · 0.95
write_continueMethod · 0.95
JsonFacadeClass · 0.85
test_fileMethod · 0.80
write_add_breakpointMethod · 0.80

Tested by

no test coverage detected