I wanna try the unit test with input is a syntax error Python program. How can I return failed for all tests? For example,
I have a syntax error Python program like :
def Syntax_Error(a,b):
c = a + b
c - #syntax error here
return c
and some tests:
import unittest
class Test_Syntax_Error(unittest.TestCase):
def test1(self):
assert Syntax_Error([1, 2]) == 2, "Should be 2"
def test2(self):
assert Syntax_Error([4, 2]) == 5, "Should be 5"
if __name__ == '__main__':
unittest.main()
And I wanna get the result something like "2 tests failed" but not the errors message of IDE
Aucun commentaire:
Enregistrer un commentaire