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']
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
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"
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']
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"
def test_run_git(): with runfilter("git", PATH_TO_LOCAL_REPO) as doc: doc.output_data()
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
def test_htmltidy(): with runfilter("htmltidy", min_valid_html, ext=".html") as doc: output = str(doc.output_data()) assert "<body>" in output
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'] == "*****@*****.**"
def test_tikz(): with runfilter('tikz', TIKZ) as doc: assert ".pdf" in doc.output_data().name assert doc.output_data().is_cached()
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()
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()
def test_run_gitrepo(): with runfilter("repo", REMOTE_REPO_HTTPS) as doc: assert len(doc.wrapper.nodes) > 20
def test_latex_dvi(): with runfilter('latexdvi', LATEX) as doc: assert ".dvi" in doc.output_data().name assert doc.output_data().is_cached()
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
def test_latex(): with runfilter('latex', LATEX) as doc: assert ".pdf" in doc.output_data().name assert doc.output_data().is_cached()
def test_tikz(): with runfilter('tikz', TIKZ) as doc: assert ".pdf" in doc.output().name assert doc.output().is_cached()
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']