diff --git a/ipykernel/tests/test_debugger.py b/ipykernel/tests/test_debugger.py
index 82e11b659..ebc04a148 100644
--- a/ipykernel/tests/test_debugger.py
+++ b/ipykernel/tests/test_debugger.py
@@ -1,5 +1,6 @@
import sys
+from IPython.core.display import HTML
import pytest
from .utils import TIMEOUT, get_reply, new_kernel
@@ -220,12 +221,15 @@ def test_rich_inspect_not_at_breakpoint(kernel_with_debug):
def test_rich_inspect_at_breakpoint(kernel_with_debug):
- code = """def f(a, b, html):
+ text_html = "
"
+ text_plain = str(HTML(text_html))
+
+ code = f"""def f(a, b, html):
c = a + b
return c
from IPython.core.display import HTML
-html = HTML("")
+html = HTML("{text_html}")
f(2, 3, html)"""
r = wait_for_debug_request(kernel_with_debug, "dumpCell", {"code": code})
@@ -284,7 +288,10 @@ def test_rich_inspect_at_breakpoint(kernel_with_debug):
{"variableName": locals_[2]["name"], "frameId": stacks[0]["id"]},
)
- assert reply["body"]["data"] == {'text/html': '', 'text/plain': ''}
+ assert reply["body"]["data"] == {
+ "text/html": text_html,
+ "text/plain": text_plain,
+ }
def test_convert_to_long_pathname():