MCPcopy
hub / github.com/Textualize/rich / test_export_html

Function test_export_html

tests/test_console.py:519–525  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517
518
519def test_export_html() -> None:
520 console = Console(record=True, width=100)
521 console.print("[b]foo <script> 'test' [link=https://example.org]Click[/link]")
522 html = console.export_html()
523 print(repr(html))
524 expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n.r1 {font-weight: bold}\n.r2 {color: #ff00ff; text-decoration-color: #ff00ff; font-weight: bold}\n.r3 {color: #008000; text-decoration-color: #008000; font-weight: bold}\nbody {\n color: #000000;\n background-color: #ffffff;\n}\n</style>\n</head>\n<body>\n <pre style="font-family:Menlo,\'DejaVu Sans Mono\',consolas,\'Courier New\',monospace"><code style="font-family:inherit"><span class="r1">foo &lt;</span><span class="r2">script</span><span class="r1">&gt; </span><span class="r3">&#x27;test&#x27;</span><span class="r1"> </span><a class="r1" href="https://example.org">Click</a>\n</code></pre>\n</body>\n</html>\n'
525 assert html == expected
526
527
528def test_export_html_inline() -> None:

Callers

nothing calls this directly

Calls 4

printMethod · 0.95
export_htmlMethod · 0.95
ConsoleClass · 0.90
printFunction · 0.50

Tested by

no test coverage detected