本文整理汇总了Python中dexy.doc.Doc.output方法的典型用法代码示例。如果您正苦于以下问题:Python Doc.output方法的具体用法?Python Doc.output怎么用?Python Doc.output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dexy.doc.Doc
的用法示例。
在下文中一共展示了Doc.output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pydoc_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_pydoc_filter():
with wrap() as wrapper:
doc = Doc("modules.txt|pydoc", contents="os math", wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert "os.ttyname:html-source" in doc.output().keys()
print doc.output().query("math.log")
示例2: test_ps2pdf_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_ps2pdf_filter():
with wrap() as wrapper:
doc = Doc("hello.ps|ps2pdf",
contents = PS,
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().is_cached()
assert doc.output().filesize() > 1000
示例3: test_html2pdf_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_html2pdf_filter():
with wrap() as wrapper:
doc = Doc("hello.html|html2pdf",
contents = "<p>hello</p>",
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().is_cached()
assert doc.output().filesize() > 1000
示例4: test_dot_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_dot_filter():
with wrap() as wrapper:
doc = Doc("graph.dot|dot",
contents = "digraph { a -> b } ",
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().is_cached()
assert doc.output().filesize() > 1000
示例5: test_rint_mock
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_rint_mock():
with wrap() as wrapper:
doc = Doc("example.R|idio|rintmock",
contents=R_SECTIONS,
wrapper=wrapper)
wrapper.run_docs(doc)
assert doc.output().is_cached()
assert doc.output().as_sectioned()['assign-vars'] == "> x <- 6\n> y <- 7\n> \n"
assert doc.output().as_sectioned()['multiply'] == "> x * y\n[1] 42\n> \n"
示例6: test_casperjs_svg2pdf_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_casperjs_svg2pdf_filter():
with wrap() as wrapper:
orig = os.path.join(TEST_DATA_DIR, 'butterfly.svg')
shutil.copyfile(orig, 'butterfly.svg')
doc = Doc("butterfly.svg|svg2pdf",
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().is_cached()
assert doc.output().filesize() > 1000
示例7: test_pdf2img_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_pdf2img_filter():
with wrap() as wrapper:
orig = os.path.join(TEST_DATA_DIR, 'color-graph.pdf')
shutil.copyfile(orig, 'example.pdf')
doc = Doc("example.pdf|pdf2img",
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().is_cached()
assert doc.output().filesize() > 1000
示例8: test_access_other_documents
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_access_other_documents():
with temprun() as runner:
doc = Doc("hello.txt|newdoc", contents="hello", runner=runner)
parent = Doc("test.txt|others", doc, contents="hello", runner=runner)
runner.docs = [parent]
runner.run()
assert parent.output().data() == """Here is a list of previous docs in this tree (not including test.txt|others).
示例9: test_split_html_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_split_html_filter():
with wrap() as wrapper:
contents="""
<p>This is at the top.</p>
<!-- split "a-page" -->
some content on a page
<!-- split "another-page" -->
some content on another page
<!-- endsplit -->
bottom
"""
doc = Doc("subdir/example.html|splithtml", contents=contents, wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.children[2].key == "subdir/a-page.html"
assert doc.children[3].key == "subdir/another-page.html"
od = doc.output().data()
assert "<p>This is at the top.</p>" in od
assert '<a href="a-page.html">' in od
assert '<a href="another-page.html">' in od
assert "bottom" in od
assert "<p>This is at the top.</p>" in doc.children[2].output().data()
assert "some content on a page" in doc.children[2].output().data()
assert "bottom" in doc.children[2].output().data()
assert "<p>This is at the top.</p>" in doc.children[3].output().data()
assert "some content on another page" in doc.children[3].output().data()
assert "bottom" in doc.children[3].output().data()
示例10: test_choose_extension_from_overlap
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_choose_extension_from_overlap():
with wrap() as wrapper:
doc = Doc("hello.py|pyg|forcelatex",
contents="""print "hello, world" """,
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert "begin{Verbatim}" in doc.output().as_text()
示例11: test_key_value_example
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_key_value_example():
with wrap() as wrapper:
doc = Doc("hello.txt|keyvalueexample", contents="hello", wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().as_text() == "foo: bar"
示例12: test_rst2odt
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_rst2odt():
with wrap() as wrapper:
doc = Doc("example.txt|rst2odt",
contents=RST,
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().filesize() > 8000
示例13: test_java_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_java_filter():
with wrap() as wrapper:
doc = Doc("hello.java|java",
contents=JAVA_SRC,
wrapper=wrapper)
wrapper.docs = [doc]
wrapper.run()
assert doc.output().data() == "Java Hello World!\n"
示例14: test_wordpress
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_wordpress(MockXmlrpclib):
with wrap() as wrapper:
with open("wordpress.json", "wb") as f:
json.dump({}, f)
with open(".dexyapis", "wb") as f:
json.dump({
'wordpress' : {
'url' : 'http://example.com',
'username' : 'foo',
'password' : 'bar'
}}, f)
# Create new (unpublished) draft
doc = mk_wp_doc(wrapper)
wrapper.run_docs(doc)
with open("wordpress.json", "rb") as f:
result = json.load(f)
assert result['postid'] == 42
assert result['publish'] == False
# Update existing draft
doc = mk_wp_doc(wrapper)
wrapper.run_docs(doc)
assert doc.output().json_as_dict().keys() == ['permaLink']
result['publish'] = True
with open("wordpress.json", "wb") as f:
json.dump(result, f)
# Publish existing draft
doc = mk_wp_doc(wrapper)
wrapper.run_docs(doc)
assert doc.output().as_text() == "http://example.com/blog/42"
# Now, separately, test an image upload.
orig = os.path.join(TEST_DATA_DIR, 'color-graph.pdf')
shutil.copyfile(orig, 'example.pdf')
doc = Doc("example.pdf|wp",
wrapper=wrapper)
with open(".dexyapis", "wb") as f:
json.dump({
'wordpress' : {
'url' : 'http://example.com',
'username' : 'foo',
'password' : 'bar'
}}, f)
wrapper.run_docs(doc)
assert doc.output().as_text() == "http://example.com/example.pdf"
# test list categories
with divert_stdout() as stdout:
WordPressFilter.docmd_list_categories()
assert stdout.getvalue() == "categoryName\nfoo\nbar\n"
示例15: test_jinjatext_filter
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import output [as 别名]
def test_jinjatext_filter():
with wrap() as wrapper:
doc = Doc("template.txt|jinjatext",
contents = "1 + 1 is {{ 1+1 }}",
wrapper=wrapper)
wrapper.run_docs(doc)
assert doc.output().as_text() == "1 + 1 is 2"