def test_concordance_line(germaparl):
    corpus = Corpus(germaparl['corpus_name'], registry_path=germaparl["registry_path"])
    query = (
        '[word="\\["] [lemma="CDU"] "/" "CSU" [word="\\]"]'
    )
    result = corpus.query(query)
    concordance = Concordance(corpus, result.df)
    line = result.df.iloc[0]
    text_line = concordance.text_line(
        line.name, line, p_show=['word', 'pos']
    )
    assert(type(text_line) == dict)
    assert('cpos' in text_line)
def test_concordance_line2df(germaparl):
    corpus = Corpus(germaparl['corpus_name'], registry_path=germaparl["registry_path"])
    query = (
        '[word="\\["] [lemma="CDU"] "/" "CSU" [word="\\]"]'
    )
    result = corpus.query(query)
    concordance = Concordance(corpus, result.df)
    line = result.df.iloc[0]
    text_line = concordance.text_line(
        line.name, line, ['word']
    )
    res = line2df(text_line)
    assert(type(res) == dict)
    assert(type(res['df']) == pd.DataFrame)
def test_concordance_line2simple(germaparl):
    corpus = Corpus(germaparl['corpus_name'], registry_path=germaparl["registry_path"])
    query = (
        '[word="\\["] [lemma="CDU"] "/" "CSU" [word="\\]"]'
    )
    result = corpus.query(query)
    concordance = Concordance(corpus, result.df)
    line = result.df.iloc[0]
    text_line = concordance.text_line(
        line.name, line, ['word']
    )
    # simple
    res = line2simple(text_line)
    assert(type(res) == dict)
    assert(type(res["text"]) == str)
    # kwic
    res = line2simple(text_line, kwic=True)
    assert(type(res) == dict)
    assert(type(res["left"]) == str)
    assert(type(res["node"]) == str)
    assert(type(res["right"]) == str)