I want to check multiple assertion like this, and after first line code is throwing an assertion error. can someone help me how to catch this assertion. I know it can be possible through try-except, but is there any other way of doing it in unit test style. Please also tell me, what is the reason this functionality is not same like multiple AssertTrue, AssertFalse methods?
import unittest
class Test1(unittest.TestCase):
def test_between(self):
print ("before")
self.assertLessEqual(999, 998, "Not less") # After this next line is not executing because this is throwing an "AssertionError: 999 not less than or equal to 998 : Not less"
# How can I catch this error, I know one way is through try,Except... but is there any proper solution available?
print ("after")
self.assertLessEqual(999, 500, "Not less") # 2nd Assertion
if __name__ == '__main__':
unittest.main()
Any kind of help is appreciated.
Regards