本文整理汇总了Python中dexy.doc.Doc.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Doc.setup方法的具体用法?Python Doc.setup怎么用?Python Doc.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dexy.doc.Doc
的用法示例。
在下文中一共展示了Doc.setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_docs
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import setup [as 别名]
def setup_docs(self):
"""
Processes args which may be doc objects or filenames with wildcards.
"""
if not hasattr(self, 'docs'):
self.docs = []
for arg in self.args:
self.log.debug("Processing arg %s" % arg)
if isinstance(arg, Doc) or isinstance(arg, PatternDoc):
doc = arg
elif isinstance(arg, list):
if not isinstance(arg[0], basestring):
raise Exception("First arg %s should be a string" % arg[0])
if not isinstance(arg[1], dict):
raise Exception("Second arg %s should be a dict" % arg[1])
if not "*" in arg[0]:
doc = Doc(arg[0], **arg[1])
else:
# This is a pattern doc or real doc TODO better way to verify?
doc = PatternDoc(arg[0], **arg[1])
elif isinstance(arg, basestring):
doc = PatternDoc(arg)
else:
raise Exception("unknown arg type %s for arg %s" % (arg.__class__.__name__, arg))
doc.runner = self
doc.setup()
self.docs.append(doc)
示例2: test_attempt_write_outside_project_root
# 需要导入模块: from dexy.doc import Doc [as 别名]
# 或者: from dexy.doc.Doc import setup [as 别名]
def test_attempt_write_outside_project_root():
with wrap() as wrapper:
try:
doc = Doc("../../example.txt",
wrapper,
[],
contents = "hello")
doc.setup()
doc.setup_datas()
assert False, 'should raise UserFeedback'
except dexy.exceptions.UserFeedback as e:
print str(e)
assert 'trying to write' in str(e)