def test_align_center_wide_fill_needs_left_and_right_padding(): """Test when fill_char's display width does not divide evenly into either gap""" text = 'foo' fill_char = '苹' width = 9 aligned = cu.align_center(text, fill_char=fill_char, width=width) assert aligned == fill_char + ' ' + text + fill_char + ' '
def test_align_center_wide_fill(): text = 'foo' fill_char = '苹' width = 7 aligned = cu.align_center(text, fill_char=fill_char, width=width) assert aligned == fill_char + text + fill_char
def test_align_center_multiline(): text = "foo\nshoes" fill_char = '-' width = 7 aligned = cu.align_center(text, fill_char=fill_char, width=width) assert aligned == ('--foo--\n' '-shoes-')
def test_align_center_wide_text(): text = '苹' fill_char = '-' width = 4 aligned = cu.align_center(text, fill_char=fill_char, width=width) assert aligned == fill_char + text + fill_char
def test_align_center(): text = 'foo' fill_char = '-' width = 5 aligned = cu.align_center(text, fill_char=fill_char, width=width) assert aligned == fill_char + text + fill_char