问题定义:
Define a class TestIsEvenMethod, which is derived from unittest.TestCase class.
Hint : Import unittest module and use TestCase utility of it.
Define a test test_isEven1, inside TestIsEvenMethod, that checks if isEven(5) returns False or not.
Hint : Use assertEqual method to verify the function output with expected output.
Add the statement unittest.main(), outside the class definition.
我的代码:
import unittest
def isEven(n):
if n%2==0:
return True
else:
return False
class TestIsEvenMethod(unittest.TestCase):
def test_isEven1(self):
self.assertEqual(isEven(5),False)
if __name__ == '__main__':
unittest.main()
程序中没有错误。但在片田县,这一进程并未进一步展开。请尽快给我一些解决这个问题的办法。我还附上了它的截图
目前没有回答
相关问题 更多 >
编程相关推荐