本文整理汇总了Python中nose.util.safe_str函数的典型用法代码示例。如果您正苦于以下问题:Python safe_str函数的具体用法?Python safe_str怎么用?Python safe_str使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_str函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: addCaptureToErr
def addCaptureToErr(self, ev):
lines = []
for (filename, description) in self._filenames_to_description.iteritems():
lines.append(ln('>> begin ''{0}'' <<'.format(description)))
with open(filename, 'r') as fp:
lines += [safe_str(fp.read())]
lines.append(ln('>> end ''{0}'' <<'.format(description)))
lines.append(safe_str(ev))
return '\n'.join(lines)
开发者ID:simonsdave,项目名称:tor-async-util,代码行数:9,代码来源:nose_plugins.py
示例2: addCaptureToErr
def addCaptureToErr(self, ev, records):
result = patcher.original(self).addCaptureToErr(ev, records)
ev = safe_str(ev)
added_lines = result[len(ev):].split('\n')
added_lines[1] = color.green(added_lines[1], bold=True)
added_lines[-1] = color.green(added_lines[-1], bold=True)
return ev + '\n'.join(added_lines)
开发者ID:natedub,项目名称:nose-beautify,代码行数:7,代码来源:monkeypatches.py
示例3: formatFailure
def formatFailure(self, test, err):
# Show output
ec, ev, tb = err
captured = self.stream_capturer.get_buffer().decode("utf-8", "replace")
if captured.strip():
ev = safe_str(ev)
out = [ev, ">> begin captured subprocess output <<", captured, ">> end captured subprocess output <<"]
return ec, "\n".join(out), tb
return err
开发者ID:rajatkapoor,项目名称:ipython,代码行数:10,代码来源:iptest.py
示例4: _dump_logs
def _dump_logs(self, ev, test):
ret = ev
if isinstance(test.test, functional.FunctionalTest):
dump = test.test.dump_logs()
if dump:
ret = '\n'.join([safe_str(ev),
ln('>> begin captured glance logging <<')] +
[dump] +
[ln('>> end captured glance logging <<')])
return ret
开发者ID:AnyBucket,项目名称:OpenStack-Install-and-Understand-Guide,代码行数:10,代码来源:logcapture.py
示例5: formatFailure
def formatFailure(self, test, err):
# Show output
ec, ev, tb = err
captured = self.stream_capturer.get_buffer().decode('utf-8', 'replace')
if captured.strip():
ev = safe_str(ev)
out = [ev, '>> begin captured subprocess output <<',
captured,
'>> end captured subprocess output <<']
return ec, '\n'.join(out), tb
return err
开发者ID:Cadair,项目名称:ipython,代码行数:12,代码来源:iptest.py
示例6: addCaptureToErr
def addCaptureToErr(self, ev, records):
return '\n'.join([safe_str(ev), ln('>> begin captured logging <<')] + \
records + \
[ln('>> end captured logging <<')])
开发者ID:AlexArgus,项目名称:affiliates-lib,代码行数:4,代码来源:logcapture.py
示例7: formatLogRecords
def formatLogRecords(self):
format = self.handler.format
return [safe_str(format(r)) for r in self.handler.buffer]
开发者ID:AlexArgus,项目名称:affiliates-lib,代码行数:3,代码来源:logcapture.py
示例8: addCaptureToErr
def addCaptureToErr(self, ev, records):
return "\n".join(
[safe_str(ev), ln(">> begin captured logging <<")] + records + [ln(">> end captured logging <<")]
)
开发者ID:GaloisInc,项目名称:echronos,代码行数:4,代码来源:logcapture.py
注:本文中的nose.util.safe_str函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论