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

Function test_rule

tests/test_rule.py:10–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10def test_rule():
11 console = Console(
12 width=16,
13 file=io.StringIO(),
14 force_terminal=True,
15 legacy_windows=False,
16 _environ={},
17 )
18 console.print(Rule())
19 console.print(Rule("foo"))
20 console.rule(Text("foo", style="bold"))
21 console.rule("foobarbazeggfoobarbazegg")
22 expected = "\x1b[92m────────────────\x1b[0m\n"
23 expected += "\x1b[92m───── \x1b[0mfoo\x1b[92m ──────\x1b[0m\n"
24 expected += "\x1b[92m───── \x1b[0m\x1b[1mfoo\x1b[0m\x1b[92m ──────\x1b[0m\n"
25 expected += "\x1b[92m─ \x1b[0mfoobarbazeg…\x1b[92m ─\x1b[0m\n"
26
27 result = console.file.getvalue()
28 assert result == expected
29
30
31def test_rule_error():

Callers

nothing calls this directly

Calls 5

printMethod · 0.95
ruleMethod · 0.95
ConsoleClass · 0.90
RuleClass · 0.90
TextClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…