Skip to content

Commit 08cc8e9

Browse files
committed
Assert the funcname is escaped in the embedded data
1 parent 201c37e commit 08cc8e9

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

Lib/test/test_profiling/test_sampling_profiler/test_collectors.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -595,12 +595,10 @@ def test_flamegraph_escapes_special_chars_in_funcname(self):
595595
with open(flamegraph_out.name, "r", encoding="utf-8") as f:
596596
content = f.read()
597597

598-
# The raw </script> must not appear unescaped in the output
599-
# (it would break out of the inline <script> block)
600-
idx = content.find("EMBEDDED_DATA")
601-
if idx != -1:
602-
after_embed = content[idx:]
603-
self.assertNotIn("</script><b>", after_embed.split("</script>")[0])
598+
# The funcname's </script> must be escaped in the embedded data so it
599+
# cannot close the inline <script> block; the raw form must be absent.
600+
self.assertIn(r"\u003c/script\u003e\u003cb\u003e", content)
601+
self.assertNotIn("</script><b>", content)
604602

605603
def test_flamegraph_collector_empty_export_fails(self):
606604
"""Test empty flamegraph export reports no output."""

0 commit comments

Comments
 (0)