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)
def test_padding_width(): s = "あいうえお" l = utils.string_width(s) assert s + " " * (15 - l) == "あいうえお "
def test_string_width(): assert utils.string_width("a") == 1 assert utils.string_width("あいうえお") == 10