Exemple #1
0
def test_xxml():
    with runfilter("xxml", XML) as doc:
        assert doc.output_data(
        )['foo:source'] == '<element id="foo">foo</element>'
        assert doc.output_data()['foo:text'] == 'foo'
        assert '<div class="highlight">' in doc.output_data(
        )['foo:html-source']
Exemple #2
0
def test_htmlcheck_on_invalid_html():
    try:
        with runfilter("tidycheck", invalid_html, ext=".html"):
            assert False, "should not get here"
    except UserFeedback as e:
        assert "missing <!DOCTYPE>" in str(e)
        assert "inserting missing 'title'" in str(e)
Exemple #3
0
def test_htmlcheck_on_invalid_html():
    try:
        with runfilter("tidycheck", invalid_html, ext=".html"):
            assert False, "should not get here"
    except UserFeedback as e:
        assert "missing <!DOCTYPE>" in str(e)
        assert "inserting missing 'title'" in str(e)
def test_broken_latex():
    try:
        with runfilter('latex', BROKEN_LATEX) as doc:
            pass
        assert False, 'should raise UserFeedback'
    except dexy.exceptions.UserFeedback as e:
        assert "Latex file not generated" in e.message
def test_add_new_document():
    with runfilter("newdoc", "hello") as doc:
        assert doc.children[-1].key == "subdir/newfile.txt|processtext"
        assert str(doc.output_data()) == "we added a new file"

        assert "doc:subdir/example.txt|newdoc" in doc.wrapper.nodes
        assert "doc:subdir/newfile.txt|processtext" in doc.wrapper.nodes
Exemple #6
0
def test_add_new_document():
    with runfilter("newdoc", "hello") as doc:
        assert doc.children[-1].key == "newfile.txt|processtext"
        assert doc.output().data() == "we added a new file"
        assert isinstance(doc.children[-1], Doc)
        assert doc.children[-1].output().data() == "Dexy processed the text 'newfile'"

        assert doc.runner.registered_docs()[0].key == "example.txt|newdoc"
        assert doc.runner.registered_docs()[1].key == "newfile.txt|processtext"
Exemple #7
0
def test_nltk_filter():
    with runfilter("nltk", BEOWULF) as doc:
        output = json.loads(doc.output().as_text())

        assert "wc" in output.keys()
        assert "collocations" in output.keys()
        assert "pos-tags" in output.keys()

        assert output['wc'] == 45
        assert ["DANISH", "HOUSE"] in output['collocations']
Exemple #8
0
def test_nltk_filter():
    with runfilter("nltk", BEOWULF) as doc:
        output = json.loads(doc.output().as_text())

        assert "wc" in output.keys()
        assert "collocations" in output.keys()
        assert "pos-tags" in output.keys()

        assert output['wc'] == 45
        assert ["DANISH", "HOUSE"] in output['collocations']
Exemple #9
0
def test_add_new_document():
    with runfilter("newdoc", "hello") as doc:
        assert doc.children[-1].key == "newfile.txt|processtext"
        assert doc.output().data() == "we added a new file"
        assert isinstance(doc.children[-1], Doc)
        assert doc.children[-1].output().data(
        ) == "Dexy processed the text 'newfile'"

        assert doc.runner.registered_docs()[0].key == "example.txt|newdoc"
        assert doc.runner.registered_docs()[1].key == "newfile.txt|processtext"
Exemple #10
0
def test_run_git():
    with runfilter("git", PATH_TO_LOCAL_REPO) as doc:
        doc.output_data()
Exemple #11
0
def test_run_git():
    with runfilter("git", PATH_TO_LOCAL_REPO) as doc:
        doc.output_data()
Exemple #12
0
def test_htmlcheck_on_valid_html():
    with runfilter("tidycheck", min_valid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert output == min_valid_html
Exemple #13
0
def test_htmltidy():
    with runfilter("htmltidy", min_valid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert "<body>" in output
Exemple #14
0
def test_git_commit():
    with runfilter("gitcommit", REMOTE_REPO_HTTPS) as doc:
        output = doc.output_data()
        patches = json.loads(output['patches'])
        assert output['author-name'] == "Ana Nelson"
        assert output['author-email'] == "*****@*****.**"
Exemple #15
0
def test_tikz():
    with runfilter('tikz', TIKZ) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
Exemple #16
0
def test_git_commit():
    with runfilter("gitcommit", REMOTE_REPO_HTTPS) as doc:
        output = doc.output_data()
        patches = json.loads(output['patches'])
        assert output['author-name'] == "Ana Nelson"
        assert output['author-email'] == "*****@*****.**"
Exemple #17
0
def test_inactive_filters_skip():
    with runfilter("inactive", "hello"):
        pass
def test_phantomjs_render_filter():
    with runfilter("phrender", "<p>hello</p>") as doc:
        assert doc.output_data().is_cached()
Exemple #19
0
def test_run_git_remote():
    with runfilter("git", REMOTE_REPO_HTTPS) as doc:
        doc.output_data()
Exemple #20
0
def test_htmlcheck_on_valid_html():
    with runfilter("tidycheck", min_valid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert output == min_valid_html
Exemple #21
0
def test_run_git_remote():
    with runfilter("git", REMOTE_REPO_HTTPS) as doc:
        doc.output_data()
def test_latex():
    with runfilter('latex', LATEX) as doc:
        assert ".pdf" in doc.output().name
        assert doc.output().is_cached()
Exemple #23
0
def test_run_gitrepo():
    with runfilter("repo", REMOTE_REPO_HTTPS) as doc:
        assert len(doc.wrapper.nodes) > 20
Exemple #24
0
def test_run_gitrepo():
    with runfilter("repo", REMOTE_REPO_HTTPS) as doc:
        assert len(doc.wrapper.nodes) > 20
Exemple #25
0
def test_latex_dvi():
    with runfilter('latexdvi', LATEX) as doc:
        assert ".dvi" in doc.output_data().name
        assert doc.output_data().is_cached()
Exemple #26
0
def test_tidyerrors():
    with runfilter("tidyerrors", invalid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert "missing <!DOCTYPE>" in output
        assert "inserting missing 'title'" in output
Exemple #27
0
def test_latex():
    with runfilter('latex', LATEX) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
Exemple #28
0
def test_htmltidy():
    with runfilter("htmltidy", min_valid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert "<body>" in output
def test_tikz():
    with runfilter('tikz', TIKZ) as doc:
        assert ".pdf" in doc.output().name
        assert doc.output().is_cached()
Exemple #30
0
def test_tidyerrors():
    with runfilter("tidyerrors", invalid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert "missing <!DOCTYPE>" in output
        assert "inserting missing 'title'" in output
Exemple #31
0
def test_xxml():
    with runfilter("xxml", XML) as doc:
        assert doc.output_data()['foo:source'] == '<element id="foo">foo</element>'
        assert doc.output_data()['foo:text'] == 'foo'
        assert '<div class="highlight">' in doc.output_data()['foo:html-source']
Exemple #32
0
def test_inactive_filters_skip():
    with runfilter("inactive", "hello"):
        pass