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

Function test_save_html

tests/test_console.py:585–595  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

583
584
585def test_save_html() -> None:
586 expected = '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="UTF-8">\n<style>\n\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">foo\n</code></pre>\n</body>\n</html>\n'
587 console = Console(record=True, width=100)
588 console.print("foo")
589 with tempfile.TemporaryDirectory() as path:
590 export_path = os.path.join(path, "example.html")
591 console.save_html(export_path)
592 with open(export_path, "rt") as html_file:
593 html = html_file.read()
594 print(repr(html))
595 assert html == expected
596
597
598def test_no_wrap() -> None:

Callers

nothing calls this directly

Calls 7

printMethod · 0.95
save_htmlMethod · 0.95
ConsoleClass · 0.90
openFunction · 0.85
joinMethod · 0.80
printFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected