Test that ast nodes can be triggered with different modes and suppressed by semicolon
()
| 86 | |
| 87 | |
| 88 | def test_interactivehooks_ast_modes_semi_suppress(): |
| 89 | """ |
| 90 | Test that ast nodes can be triggered with different modes and suppressed |
| 91 | by semicolon |
| 92 | """ |
| 93 | saved_mode = ip.ast_node_interactivity |
| 94 | ip.ast_node_interactivity = "last_expr_or_assign" |
| 95 | |
| 96 | try: |
| 97 | with AssertNotPrints("2"): |
| 98 | ip.run_cell("x = 1+1;", store_history=True) |
| 99 | |
| 100 | with AssertNotPrints("7"): |
| 101 | ip.run_cell("y = 1+6; # comment with a semicolon", store_history=True) |
| 102 | |
| 103 | with AssertNotPrints("9"): |
| 104 | ip.run_cell("z = 1+8;\n#commented_out_function()", store_history=True) |
| 105 | |
| 106 | finally: |
| 107 | ip.ast_node_interactivity = saved_mode |
| 108 | |
| 109 | |
| 110 | def test_capture_display_hook_format(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…