The code is as follows:
If __name__=="__main__ ':
Suite=unittest. TestSuite ()
Test_is_prime test_cases=[TestMyfunc (" "), TestMyfunc (" test_add "), TestMyfunc (" test_devide ")]
Suite. AddTests (test_cases)
# test
Runner=unittest. TextTestRunner (verbosity=2)
Runner. The run (suite)
Execution of the order should be: TestMyfunc (" test_is_prime "), TestMyfunc (" test_add "), TestMyfunc (" test_devide "),
But code to run the result is: test_add, test_devide test_is_prime such order
Asking our great god under the guidance of
CodePudding user response:
try addTestCode=python]
Def suite () :
Suite=unittest. TestSuite ()
Suite. AddTest (BarTestCase (' test_nine))
Suite. AddTest (FooTestCase (' test_ten))
Suite. AddTest (FooTestCase (' test_eleven))
Suite. AddTest (BarTestCase (' test_twelve))
Return suite
[/code]