I am trying to understand a traceback error that I am receiving. See below.
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
Does the above error mean that "sunset" should not be in the cached file?
A point about nomenclature. You are getting a AssertionError
. The error is printed along with the traceback, which indicates the sequence of calls that led to that error.
In your particular case, it looks like the error is caused because the assertion made by self.assertTrue(...)
came out False
. You are asserting that the string "sunset"
is in testfilestr
, but it is not. Probably because it is in the cache file instead.
The second argument to assertTrue
is a message, which you see as the message to the AssertionError
. This argument is optional, and is usually used to clarify the error beyond the obvious default message, which would be something to the effect of "sunset" in testfilestr is False, expected True
.