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

Function test_expand_bar

tests/test_progress.py:223–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

221
222
223def test_expand_bar() -> None:
224 console = Console(
225 file=io.StringIO(),
226 force_terminal=True,
227 width=10,
228 color_system="truecolor",
229 legacy_windows=False,
230 _environ={},
231 )
232 progress = Progress(
233 BarColumn(bar_width=None),
234 console=console,
235 get_time=lambda: 1.0,
236 auto_refresh=False,
237 )
238 progress.add_task("foo")
239 with progress:
240 pass
241 expected = "\x1b[?25l\x1b[38;5;237m━━━━━━━━━━\x1b[0m\r\x1b[2K\x1b[38;5;237m━━━━━━━━━━\x1b[0m\n\x1b[?25h"
242 render_result = console.file.getvalue()
243 print("RESULT\n", repr(render_result))
244 print("EXPECTED\n", repr(expected))
245 assert render_result == expected
246
247
248def test_progress_with_none_total_renders_a_pulsing_bar() -> None:

Callers

nothing calls this directly

Calls 5

add_taskMethod · 0.95
ConsoleClass · 0.90
ProgressClass · 0.90
BarColumnClass · 0.90
printFunction · 0.50

Tested by

no test coverage detected