我在一个名为test2.txt
.
>>> def faulty():
... yield 5
... return 7
Traceback(most recent call last):
SyntaxError: 'return' with argument inside generator(<doctest test.txt[0]>,line 3)
我用 调用测试运行python -m test2.txt
。下面的结果完全出乎我的意料。
我的想法是测试应该成功,因为我已经在我的test2.txt
文件中编写了预期的输出,并且它“几乎”与我从控制台输出中得到的结果相匹配。我尝试添加'File "G:\"'.... line
?但测试仍然失败。