【发布时间】:2012-02-14 15:55:33
【问题描述】:
希望这个问题有一个简单的答案。这可能是我在做的一些愚蠢的事情!
在 Eclipse 中,为以下代码运行 Python 单元测试:
import unittest
from ShipClass import *
from Graphics import *
class UnitTesting(unittest.TestCase):
def testInit(self):
self.screen = load_screen()
assert load_background() == True
print("Here!")
def spawnShip(self):
ship = Ship((self.screen.get_rect().x, self.screen.get_rect().y))
self.screen.blit(ship.image, ship.rect)
print("Here!")
assert updateDisplay() == True
代码只输出一个“这里!”到控制台。它还说,“Ran 1 test...”等等。
为什么不运行两个测试?
感谢您的帮助。
【问题讨论】:
标签: python eclipse unit-testing