本文整理汇总了Python中dexy.wrapper.Wrapper.docs方法的典型用法代码示例。如果您正苦于以下问题:Python Wrapper.docs方法的具体用法?Python Wrapper.docs怎么用?Python Wrapper.docs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dexy.wrapper.Wrapper
的用法示例。
在下文中一共展示了Wrapper.docs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_caching
# 需要导入模块: from dexy.wrapper import Wrapper [as 别名]
# 或者: from dexy.wrapper.Wrapper import docs [as 别名]
def test_caching():
with tempdir():
wrapper1 = Wrapper()
with open("abc.txt", "w") as f:
f.write("these are the contents")
doc1 = Doc("abc.txt|dexy", wrapper=wrapper1)
wrapper1.docs = [doc1]
wrapper1.run()
assert isinstance(doc1.artifacts[0], InitialArtifact)
hashstring_0_1 = doc1.artifacts[0].hashstring
assert isinstance(doc1.artifacts[1], FilterArtifact)
hashstring_1_1 = doc1.artifacts[1].hashstring
wrapper2 = Wrapper()
doc2 = Doc("abc.txt|dexy", wrapper=wrapper2)
wrapper2.docs = [doc2]
wrapper2.run()
assert isinstance(doc2.artifacts[0], InitialArtifact)
hashstring_0_2 = doc2.artifacts[0].hashstring
assert isinstance(doc2.artifacts[1], FilterArtifact)
hashstring_1_2 = doc2.artifacts[1].hashstring
assert hashstring_0_1 == hashstring_0_2
assert hashstring_1_1 == hashstring_1_2
示例2: test_caching_virtual_file
# 需要导入模块: from dexy.wrapper import Wrapper [as 别名]
# 或者: from dexy.wrapper.Wrapper import docs [as 别名]
def test_caching_virtual_file():
with tempdir():
wrapper1 = Wrapper()
doc1 = Doc("abc.txt|dexy",
contents = "these are the contents",
wrapper=wrapper1)
wrapper1.docs = [doc1]
wrapper1.run()
assert isinstance(doc1.artifacts[0], InitialVirtualArtifact)
hashstring_0_1 = doc1.artifacts[0].hashstring
assert isinstance(doc1.artifacts[1], FilterArtifact)
hashstring_1_1 = doc1.artifacts[1].hashstring
wrapper2 = Wrapper()
doc2 = Doc(
"abc.txt|dexy",
contents = "these are the contents",
wrapper=wrapper2)
wrapper2.docs = [doc2]
wrapper2.run()
assert isinstance(doc2.artifacts[0], InitialVirtualArtifact)
hashstring_0_2 = doc2.artifacts[0].hashstring
assert isinstance(doc2.artifacts[1], FilterArtifact)
hashstring_1_2 = doc2.artifacts[1].hashstring
assert hashstring_0_1 == hashstring_0_2
assert hashstring_1_1 == hashstring_1_2
示例3: test_wrapper_run
# 需要导入模块: from dexy.wrapper import Wrapper [as 别名]
# 或者: from dexy.wrapper.Wrapper import docs [as 别名]
def test_wrapper_run():
with tempdir():
wrapper = Wrapper()
wrapper.setup_dexy_dirs()
d1 = Doc("abc.txt|outputabc", contents="these are the contents", wrapper=wrapper)
d2 = Doc("hello.txt|outputabc", contents="these are more contents", wrapper=wrapper)
assert d1.state == 'setup'
assert d2.state == 'setup'
wrapper.docs = [d1, d2]
wrapper.run()
assert d1.state == 'complete'
assert d2.state == 'complete'