tests.test_layout module¶
Tests for click_extra.layout: measuring a line and composing one.
- tests.test_layout.test_center_in_rule_draws_an_unbroken_line_for_no_label(label)[source]¶
Naming nothing draws a divider, not a frame around an empty middle.
- tests.test_layout.test_center_in_rule_measures_a_styled_label_unstyled()[source]¶
A label’s escapes occupy no cell, so they must not shorten the rule.
- tests.test_layout.test_center_in_rule_paints_the_rule_and_leaves_the_label_alone()[source]¶
The rule recedes by default, and a caller’s own label styling survives.
- tests.test_layout.test_fit_columns_floors_at_nothing_by_default()[source]¶
The floor belongs to whoever lays the text out, not to the measure.
- tests.test_layout.test_cell_width_discounts_what_a_terminal_draws_nowhere(text, cells)[source]¶
Escapes and hyperlinks measure nothing, and a tab measures to its stop.
wcwidth.wcswidthrefuses any string carrying a control character and answers-1: a measure built on it falls back to the character count of a styled string, 16 for a redapricotthe terminal draws in 7.
- tests.test_layout.test_cell_width_is_never_negative()[source]¶
A control character measures what a terminal advances by, never
-1.
- tests.test_layout.test_pad_to_measures_the_text_a_terminal_draws()[source]¶
str.ljustcounts escapes it cannot see, so a styled line pads short.
- tests.test_layout.test_pad_to_closes_a_style_before_the_blanks()[source]¶
A background left open would otherwise bleed across the gap.
- tests.test_layout.test_pad_to_leaves_text_already_wide_enough_alone()[source]¶
Nothing to pad, nothing added, reset included.