本文整理汇总了Python中Target.isRed方法的典型用法代码示例。如果您正苦于以下问题:Python Target.isRed方法的具体用法?Python Target.isRed怎么用?Python Target.isRed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Target
的用法示例。
在下文中一共展示了Target.isRed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTargetFunctions
# 需要导入模块: import Target [as 别名]
# 或者: from Target import isRed [as 别名]
class TestTargetFunctions (unittest.TestCase):
def setUp (self):
""" Initializes a green and red target
"""
self.redTarget = Target ()
self.greenTarget = Target (isRed = False)
def tearDown (self):
""" Nothing to tear down
"""
pass
def test_update (self):
""" Tests that update increments the counter.
Then tests when counter resets, image is changed
"""
# Test that update increments the counter
self.redTarget.update()
self.assertEqual(self.redTarget._counter, 1)
# Test that when counter resets, currentImage increments
while self.redTarget._counter > 0:
self.redTarget.update()
self.assertEqual (self.redTarget._currentImage, 3)
def test_timedOut (self):
""" Tests that a target successfully times out
"""
for x in range (0, COUNTDOWN_FRAME * 5):
self.greenTarget.update ()
self.assertTrue (self.greenTarget.timedOut)
def test_isRed (self):
""" Tests isRed
"""
self.assertTrue (self.redTarget.isRed ())