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

Function test_vertical_align_top

tests/test_table.py:161–181  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159
160
161def test_vertical_align_top():
162 console = Console(_environ={})
163
164 def make_table(vertical_align):
165 table = Table(show_header=False, box=box.SQUARE)
166 table.add_column(vertical=vertical_align)
167 table.add_row("foo", "\n".join(["bar"] * 5))
168
169 return table
170
171 with console.capture() as capture:
172 console.print(make_table("top"))
173 console.print()
174 console.print(make_table("middle"))
175 console.print()
176 console.print(make_table("bottom"))
177 console.print()
178 result = capture.get()
179 print(repr(result))
180 expected = "┌─────┬─────┐\n│ foo │ bar │\n│ │ bar │\n│ │ bar │\n│ │ bar │\n│ │ bar │\n└─────┴─────┘\n\n┌─────┬─────┐\n│ │ bar │\n│ │ bar │\n│ foo │ bar │\n│ │ bar │\n│ │ bar │\n└─────┴─────┘\n\n┌─────┬─────┐\n│ │ bar │\n│ │ bar │\n│ │ bar │\n│ │ bar │\n│ foo │ bar │\n└─────┴─────┘\n\n"
181 assert result == expected
182
183
184@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

captureMethod · 0.95
printMethod · 0.95
ConsoleClass · 0.90
make_tableFunction · 0.85
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected