本文整理汇总了Python中behave.log_capture.LoggingCapture.getvalue方法的典型用法代码示例。如果您正苦于以下问题:Python LoggingCapture.getvalue方法的具体用法?Python LoggingCapture.getvalue怎么用?Python LoggingCapture.getvalue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类behave.log_capture.LoggingCapture
的用法示例。
在下文中一共展示了LoggingCapture.getvalue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_value_returns_all_log_records
# 需要导入模块: from behave.log_capture import LoggingCapture [as 别名]
# 或者: from behave.log_capture.LoggingCapture import getvalue [as 别名]
def test_get_value_returns_all_log_records(self):
class FakeConfig(object):
logging_filter = None
logging_format = None
logging_datefmt = None
logging_level = None
fake_records = [object() for x in range(0, 10)]
handler = LoggingCapture(FakeConfig())
handler.buffer = fake_records
with patch.object(handler.formatter, 'format') as format:
format.return_value = 'foo'
expected = '\n'.join(['foo'] * len(fake_records))
eq_(handler.getvalue(), expected)
calls = [args[0][0] for args in format.call_args_list]
eq_(calls, fake_records)
示例2: test_get_value_returns_all_log_records
# 需要导入模块: from behave.log_capture import LoggingCapture [as 别名]
# 或者: from behave.log_capture.LoggingCapture import getvalue [as 别名]
def test_get_value_returns_all_log_records(self):
__pychecker__ = "no-shadowbuiltin unusednames=x"
class FakeConfig(object):
logging_filter = None
logging_format = None
logging_datefmt = None
logging_level = None
fake_records = [object() for x in range(0, 10)]
handler = LoggingCapture(FakeConfig())
handler.buffer = fake_records
# pylint: disable=W0622
# W0622 Redefining built-in format
with patch.object(handler.formatter, 'format') as format:
format.return_value = 'foo'
expected = '\n'.join(['foo'] * len(fake_records))
eq_(handler.getvalue(), expected)
calls = [args[0][0] for args in format.call_args_list]
eq_(calls, fake_records)