Is there any way in Python2.7, we can capture and log the assert statements in general python scripting despite of assert is True or False Suppose I assert following line in code:
assert len(lst) ==4
So is any way can log what statement is passed, at what line and it is true or false. I do not want to use a wrapper function, looking for something inbuilt in python .
Note: What I want to achieve is , suppose I have legacy code having 1000's of assert statements , without changing the code, I should be able to log which assert statement is executed and what is the output, Is its achievable in python 2.7.
assertto behave like something that isn't anassert. It's like asking if there's a way to make adictbehave like alist... the only way that I can think that you might be able to accomplish this is by registering an import hook which changes all of theassertstatements into appropriateloggingstatements...