Ejemplo n.º 1
0
def layer_tree_one__frst_split_period__then_rplc_t__other_rplc_r(txt):
    rm_t = partial(rm_char, char='t')
    rm_t_split = preiter_iter_postiter(iter_func=spliter, post_iter=rm_t)
    rm_t_split.__name__ = 'rm_t_split'
    rm_r = partial(rm_char, char='r')
    rm_r_split = preiter_iter_postiter(iter_func=spliter, post_iter=rm_r)
    rm_r_split.__name__ = 'rm_r_split'

    func = one_layer_tree(split_on, *[rm_t_split, rm_r_split])
    return func(txt)
Ejemplo n.º 2
0
def test__preiter_iter_postiter__four__remove_t_pre_basic_split_then_undo_in_post_split():
    rplc_t = partial(rm_char, char='t', rplcwith='_-_')
    undo_rplc_t = partial(rm_char, char='_-_', rplcwith='t')
    func = preiter_iter_postiter(iter_func=spliter, pre_iter=rplc_t, post_iter=undo_rplc_t)
    for tkn, ptkn in zip(spliter(SMPLTXT), func(SMPLTXT)):
        if 't' in tkn:
            assert('t' in ptkn)
        else:
            assert('t' not in ptkn)
Ejemplo n.º 3
0
def test__preiter_iter_postiter__three__remove_t_post_basic_split():
    rm_t = partial(rm_char, char='t')
    func = preiter_iter_postiter(iter_func=spliter, post_iter=rm_t)
    for tkn in func(SMPLTXT):
        assert('t' not in tkn)
Ejemplo n.º 4
0
def test__preiter_iter_postiter__one__basic_spliter_only():
    func = preiter_iter_postiter(iter_func=spliter)
    assert(list(func(txt=SMPLTXT)) == SMPLTOKENS)