libvt.testing¶
Column-exact visual boxed screen formatting and test assertions for libvt.
-
libvt.testing.assert_screen(target, expected, *, cursor=None)¶libvt.testing.assert_screen(target, expected, *, cursor=None)¶
Assert that target’s literal visible text (and cursor) matches expected.
Unlike
assert_screen_box(),assert_screennever strips┌──┐border glyphs, so applications drawing literal box-drawing borders match verbatim.- Parameters:
target (
Terminal|Snapshot) – Live terminal or immutable snapshot under test.expected (
str|Sequence[str]) – Expected visible text (dedented when passed as a multi-line string) or explicit sequence of right-trimmed row strings.cursor (
tuple[int,int] |None,optional) – Expected zero-based(row, col)cursor coordinates, if checked.
- Raises:
ScreenAssertionError– When visible lines or cursor coordinates differ from expected.- Return type:
-
libvt.testing.assert_screen_box(target, expected, *, cursor=None)¶libvt.testing.assert_screen_box(target, expected, *, cursor=None)¶
Assert that target matches a
┌──┐/│..│boxed diagram.Validates exact display-column width across every row, preserves interior and trailing spaces as well as blank rows, and checks soft-wrap flags via trailing
│Wmarkers outside the right pipe.- Parameters:
- Raises:
ValueError– When expected does not form a rectangular┌──┐/└──┘frame.ScreenAssertionError– When screen dimensions, cell contents, soft-wrap flags, or cursor coordinates differ from expected.
- Return type:
-
libvt.testing.format_flight_recorder(target)¶libvt.testing.format_flight_recorder(target)¶
Render compact flight-recorder state and recent disassembled VT bytes.
-
libvt.testing.format_screen_box(target, *, rows=None, cols=None)¶libvt.testing.format_screen_box(target, *, rows=None, cols=None)¶
Render target inside a column-aligned Unicode
┌──┐/│..│frame.Soft-wrapped rows display a
Wmarker immediately right of the right border, and C0/C1/BiDi override codepoints are escaped safely.