コード例 #1
0
ファイル: test_tidy_filters.py プロジェクト: dexy/dexy
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)
コード例 #2
0
ファイル: test_example_filters.py プロジェクト: GWhized/dexy
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
コード例 #3
0
ファイル: test_example_filters.py プロジェクト: dexy/dexy
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
コード例 #4
0
def test_no_blank_anonymous_first_section():
    with runfilter('soups',
                   "<h1>first</h1><p>foo</p><h1>second</h1>",
                   ext=".html") as doc:
        assert doc.output_data().keys() == [
            u'first', u'second', u'Actual Document Contents'
        ]
コード例 #5
0
def test_nested_html():
    with runfilter('soups', nested_html) as doc:
        data = doc.output_data()
        assert unicode(data) == expected
        assert data.keys() == [
            u'First', u'Second', u'Actual Document Contents'
        ]
コード例 #6
0
ファイル: test_tidy_filters.py プロジェクト: GWhized/dexy
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)
コード例 #7
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']
コード例 #8
0
ファイル: test_soup_filters.py プロジェクト: GWhized/dexy
def test_markdown_output():
    with runfilter('markdown|soups', md) as doc:
        data = doc.output_data()

        assert data.keys() == [u'foo', u'bar', u'barbaz', u'Actual Document Contents']

        assert data['foo']['level'] == 1
        assert data['bar']['level'] == 1
        assert data['barbaz']['level'] == 2

        assert data['foo']['id'] == 'foo'
        assert data['bar']['id'] == 'bar'
        assert data['barbaz']['id'] == 'barbaz'
コード例 #9
0
ファイル: test_soup_filters.py プロジェクト: dexy/dexy
def test_markdown_output():
    with runfilter('markdown|soups', md) as doc:
        data = doc.output_data()

        assert list(data.keys()) == ['foo', 'bar', 'barbaz', 'Actual Document Contents']

        assert data['foo']['level'] == 1
        assert data['bar']['level'] == 1
        assert data['barbaz']['level'] == 2

        assert data['foo']['id'] == 'foo'
        assert data['bar']['id'] == 'bar'
        assert data['barbaz']['id'] == 'barbaz'
コード例 #10
0
ファイル: test_soup_filters.py プロジェクト: GWhized/dexy
def test_soup_sections_filter():
    with runfilter('soups', html, ext='.html') as doc:
        data = doc.output_data()

        assert data.keys() == [u'The First Named Section',
                u'Nested In First Section', u'The 2nd Section',
                u'Actual Document Contents']

        first_section = data["The First Named Section"]
        assert first_section['contents'] == None
        assert first_section['level'] == 1

        nested_section = data["Nested In First Section"]
        assert nested_section['level'] == 2
        assert first_section['contents'] == None

        final_section = data["The 2nd Section"]
        assert final_section['level'] == 1
        assert final_section['contents'] == None

        contents_section = data['Actual Document Contents']
        assert contents_section['level'] == 1
コード例 #11
0
ファイル: test_soup_filters.py プロジェクト: dexy/dexy
def test_soup_sections_filter():
    with runfilter('soups', html, ext='.html') as doc:
        data = doc.output_data()

        assert list(data.keys()) == ['The First Named Section',
                'Nested In First Section', 'The 2nd Section',
                'Actual Document Contents']

        first_section = data["The First Named Section"]
        assert first_section['contents'] == None
        assert first_section['level'] == 1

        nested_section = data["Nested In First Section"]
        assert nested_section['level'] == 2
        assert first_section['contents'] == None

        final_section = data["The 2nd Section"]
        assert final_section['level'] == 1
        assert final_section['contents'] == None

        contents_section = data['Actual Document Contents']
        assert contents_section['level'] == 1
コード例 #12
0
ファイル: test_utils.py プロジェクト: dexy/dexy
def test_inactive_filters_skip():
    with runfilter("inactive", "hello"):
        pass
コード例 #13
0
ファイル: test_xxml_filters.py プロジェクト: GWhized/dexy
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']
コード例 #14
0
ファイル: test_tidy_filters.py プロジェクト: GWhized/dexy
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
コード例 #15
0
ファイル: test_soup_filters.py プロジェクト: dexy/dexy
def test_nested_html():
    with runfilter('soups', nested_html) as doc:
        data = doc.output_data()
        assert str(data) == expected
        assert list(data.keys()) == ['First', 'Second', 'Actual Document Contents']
コード例 #16
0
ファイル: test_latex_filters.py プロジェクト: dexy/dexy
def test_latex():
    with runfilter('latex', LATEX) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #17
0
ファイル: test_latex_filters.py プロジェクト: dexy/dexy
def test_latex_dvi():
    with runfilter('latexdvi', LATEX) as doc:
        assert ".dvi" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #18
0
def test_run_git():
    with runfilter("git", PATH_TO_LOCAL_REPO) as doc:
        doc.output_data()
コード例 #19
0
ファイル: test_tidy_filters.py プロジェクト: dexy/dexy
def test_htmltidy():
    with runfilter("htmltidy", min_valid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert "<body>" in output
コード例 #20
0
ファイル: test_soup_filters.py プロジェクト: GWhized/dexy
def test_no_blank_anonymous_first_section():
    with runfilter('soups', "<h1>first</h1><p>foo</p><h1>second</h1>", ext=".html") as doc:
        assert doc.output_data().keys() == [u'first', u'second', u'Actual Document Contents']
コード例 #21
0
ファイル: test_soup_filters.py プロジェクト: GWhized/dexy
def test_nested_html():
    with runfilter('soups', nested_html) as doc:
        data = doc.output_data()
        assert unicode(data) == expected
        assert data.keys() == [u'First', u'Second', u'Actual Document Contents']
コード例 #22
0
ファイル: test_latex_filters.py プロジェクト: stephenhay/dexy
def test_tikz():
    with runfilter('tikz', TIKZ) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #23
0
def test_run_gitrepo():
    with runfilter("repo", REMOTE_REPO_HTTPS) as doc:
        assert len(doc.wrapper.nodes) > 20
コード例 #24
0
ファイル: test_tidy_filters.py プロジェクト: GWhized/dexy
def test_htmltidy():
    with runfilter("htmltidy", min_valid_html, ext=".html") as doc:
        output = str(doc.output_data())
        assert "<body>" in output
コード例 #25
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'] == "*****@*****.**"
コード例 #26
0
def test_phantomjs_render_filter():
    with runfilter("phrender", "<p>hello</p>") as doc:
        assert doc.output_data().is_cached()
コード例 #27
0
def test_run_git_remote():
    with runfilter("git", REMOTE_REPO_HTTPS) as doc:
        doc.output_data()
コード例 #28
0
def test_tikz():
    with runfilter('tikz', TIKZ) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #29
0
ファイル: test_latex_filters.py プロジェクト: dexy/dexy
def test_tikz():
    # TODO fix for tikz not installed
    raise SkipTest()
    with runfilter('tikz', TIKZ) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #30
0
def test_latex():
    with runfilter('latex', LATEX) as doc:
        assert ".pdf" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #31
0
ファイル: test_tidy_filters.py プロジェクト: dexy/dexy
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
コード例 #32
0
ファイル: test_tidy_filters.py プロジェクト: GWhized/dexy
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
コード例 #33
0
ファイル: test_tidy_filters.py プロジェクト: dexy/dexy
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
コード例 #34
0
ファイル: test_utils.py プロジェクト: GWhized/dexy
def test_inactive_filters_skip():
    with runfilter("inactive", "hello"):
        pass
コード例 #35
0
def test_latex_dvi():
    with runfilter('latexdvi', LATEX) as doc:
        assert ".dvi" in doc.output_data().name
        assert doc.output_data().is_cached()
コード例 #36
0
def test_phantomjs_render_filter():
    with runfilter("phrender", "<p>hello</p>") as doc:
        assert doc.output_data().is_cached()