Skip to content

Commit 1ffd278

Browse files
committed
Add richInspectVariables test with HTML repr
1 parent 3f9ed67 commit 1ffd278

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ipykernel/tests/test_debugger.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ def test_rich_inspect_not_at_breakpoint(kernel_with_debug):
220220

221221

222222
def test_rich_inspect_at_breakpoint(kernel_with_debug):
223-
code = """def f(a, b):
223+
code = """def f(a, b, html):
224224
c = a + b
225225
return c
226226
227-
f(2, 3)"""
227+
from IPython.core.display import HTML
228+
html = HTML("<div><p>Hello World!</p></div>")
229+
f(2, 3, html)"""
228230

229231
r = wait_for_debug_request(kernel_with_debug, "dumpCell", {"code": code})
230232
source = r["body"]["sourcePath"]
@@ -276,6 +278,14 @@ def test_rich_inspect_at_breakpoint(kernel_with_debug):
276278

277279
assert reply["body"]["data"] == {"text/plain": locals_[0]["value"]}
278280

281+
reply = wait_for_debug_request(
282+
kernel_with_debug,
283+
"richInspectVariables",
284+
{"variableName": locals_[2]["name"], "frameId": stacks[0]["id"]},
285+
)
286+
287+
assert reply["body"]["data"] == {'text/html': '<div><p>Hello World!</p></div>', 'text/plain': '<IPython.core.displa...ML object>'}
288+
279289

280290
def test_convert_to_long_pathname():
281291
if sys.platform == "win32":

0 commit comments

Comments
 (0)