Exemple #1
0
def set_filepath(mapper, connection, target):
    if target.content is None:
        target.content = ""
    target.name = target.name.strip().strip("/")
    target._filepath = target.filepath
    target._length_name = string_width(target.name)
    target._length_tag_names = string_width(target.tag_names)
    target._length_dirname = string_width(target.category.dirname)
Exemple #2
0
def test_padding_width():
    s = "あいうえお"
    l = utils.string_width(s)
    assert s + " " * (15 - l) == "あいうえお     "
Exemple #3
0
def test_string_width():
    assert utils.string_width("a") == 1
    assert utils.string_width("あいうえお") == 10