def convert(workflow): """Convert input pattern""" sequence = "".join(workflow.args) results = matching_sequence(sequence) layout_main = os.getenv("MAIN_LAYOUT", "xiaohe") layout_secondary = os.getenv("SECONDARY_LAYOUT", "zhuyin") xiaohes = convert_layout(results, layout_main) zhuyins = convert_layout(results, layout_secondary) for zhuyin, xiaohe in zip(zhuyins, xiaohes): workflow.add_item(title=xiaohe, subtitle=zhuyin) workflow.send_feedback()
def test_zhuyin_zhen(): assert "".join(convert_layout(matching_sequence("zhen"), "zhuyin")) == "ㄓㄣ"
def test_zhuyin_bang(): assert "".join(convert_layout(matching_sequence("bang"), "zhuyin")) == "ㄅㄤ"
def test_zhuyin_xian(): assert "".join(convert_layout(matching_sequence("xian"), "zhuyin")) == "ㄒㄧㄢ"
def test_zhuyin_a(): assert "".join(convert_layout(matching_sequence("a"), "zhuyin")) == "ㄚ"
def test_zhuyin_lv(): assert "".join(convert_layout(matching_sequence("lv"), "zhuyin")) == "ㄌㄩ"