本文整理匯總了Python中doctest.REPORT_UDIFF屬性的典型用法代碼示例。如果您正苦於以下問題:Python doctest.REPORT_UDIFF屬性的具體用法?Python doctest.REPORT_UDIFF怎麽用?Python doctest.REPORT_UDIFF使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類doctest
的用法示例。
在下文中一共展示了doctest.REPORT_UDIFF屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_traceback_formatting_without_stack_hidden
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import REPORT_UDIFF [as 別名]
def test_traceback_formatting_without_stack_hidden(self):
# During the testtools test run, we show our levels of the stack,
# because we want to be able to use our test suite to debug our own
# code.
result = self.makeResult()
test = make_erroring_test()
test.run(result)
self.assertThat(
result.errors[0][1],
DocTestMatches(
'Traceback (most recent call last):\n'
' File "...testtools...runtest.py", line ..., in _run_user\n'
' return fn(*args, **kwargs)\n'
' File "...testtools...testcase.py", line ..., in _run_test_method\n'
' return self._get_test_method()()\n'
' File "...testtools...tests...test_testresult.py", line ..., in error\n'
' 1/0\n'
'ZeroDivisionError: ...\n',
doctest.ELLIPSIS | doctest.REPORT_UDIFF))
示例2: _get_report_choice
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import REPORT_UDIFF [as 別名]
def _get_report_choice(key):
"""
This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
"""
import doctest
return {
DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
DOCTEST_REPORT_CHOICE_NONE: 0,
}[key]
示例3: _get_report_choice
# 需要導入模塊: import doctest [as 別名]
# 或者: from doctest import REPORT_UDIFF [as 別名]
def _get_report_choice(key: str) -> int:
"""
This function returns the actual `doctest` module flag value, we want to do it as late as possible to avoid
importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.
"""
import doctest
return {
DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
DOCTEST_REPORT_CHOICE_NONE: 0,
}[key]