【发布时间】:2017-03-15 15:43:15
【问题描述】:
我正在尝试了解我收到的回溯错误。见下文。
Traceback (most recent call last):
File "test.py", line 291, in test_cache_in_function
self.assertTrue("sunset" in testfilestr,"Testing that the sunset request was cached")
AssertionError: Testing that the sunset request was cached
上述错误是否意味着“日落”不应该在缓存文件中?
【问题讨论】:
-
这意味着
testfilestr中不存在字符串“sunset”,因此assertTrue失败。 -
是的。为什么不打印字符串?
-
看看最初的 try-catch 块。有两个变量名浮动:
saved_cache和CACHE_DICTION。我猜只有第二个是正确的。 -
发布一个重现错误的最小代码示例通常是个好主意。
标签: python assertion traceback