[英]python doctest truncates expected output
I want to run this doctest and check the output: 我想运行此doctest并检查输出:
>>> execfile("scss_converter_1.5.1_v1.py") #doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE
body {
.boxholder {
.box {
.col {
.something {
.something.else {
}
}
img {
}
a {
.my.span {
}
}
ul {
.list-item {
}
}
#some-button {
}
}
}
.another-box.crazy.very.insane {
}
}
}
"""
But when I run the test it says the expected output is: 但是当我运行测试时,它说预期的输出是:
Expected:
body {
Any way to make it expect the full string with all the words? 有什么办法让它期望包含所有单词的完整字符串? A new line usually means the end of the expected output doesn't it so it is tricky. 换行通常意味着预期输出的末尾不是,所以很棘手。
Cheers 干杯
As per the docs , the expected output of a doctest ends at an all-whitespace line or a line starting with >>>
. 根据docs ,doctest的预期输出以全空白行或以>>>
开头的行结束。 If the whitespace lines are an essential part of the output, you can escape them by replacing all the blank lines with <BLANKLINE>
. 如果空格行是输出的必要部分,则可以通过将所有空白行替换为<BLANKLINE>
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.