Skip to main content

Module testing

Module testing 

Source
Expand description

Test utilities for output component testing.

This module provides infrastructure for capturing and asserting on output from RichOutput components in tests.

Modules§

fixtures
Test fixtures for common scenarios. Test fixtures for common output scenarios.

Structs§

OutputEntry
A single captured output entry with metadata.
TestOutput
Test output buffer that captures all output for assertions.

Enums§

OutputLevel
Output classification for test assertions.

Functions§

assert_contains
Assert output contains text (after stripping ANSI codes).
assert_contains_in_order
Assert output contains all expected substrings in order.
assert_has_ansi
Assert output has ANSI codes (for rich mode testing).
assert_max_width
Assert all lines are within max width.
assert_no_ansi
Assert output has no ANSI codes (for plain mode testing).
assert_not_contains
Assert output does NOT contain text.
capture
Capture output from a closure in the specified mode.
capture_both
Capture both plain and rich output for comparison.
capture_with_width
Capture with custom terminal width.
debug_output
Log captured output for debugging.
is_verbose
Enable verbose test logging (set FASTAPI_TEST_VERBOSE=1).
strip_ansi_codes
Strip ANSI escape codes from a string.