本文整理匯總了Python中pymock.Controller.setCount方法的典型用法代碼示例。如果您正苦於以下問題:Python Controller.setCount方法的具體用法?Python Controller.setCount怎麽用?Python Controller.setCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymock.Controller
的用法示例。
在下文中一共展示了Controller.setCount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testSetCount
# 需要導入模塊: from pymock import Controller [as 別名]
# 或者: from pymock.Controller import setCount [as 別名]
def testSetCount(self):
"""Verify that settting the count works"""
c = Controller()
a = BaseAction('x')
c.record(a)
self.failUnless(a.playbackPolicy.remaining == 1)
c.setCount(2)
self.failUnless(a.playbackPolicy.remaining == 2)
示例2: testPlaybackWithMultipleCounts
# 需要導入模塊: from pymock import Controller [as 別名]
# 或者: from pymock.Controller import setCount [as 別名]
def testPlaybackWithMultipleCounts(self):
"""Perform playback with multiple values"""
c = Controller()
action = BaseAction('x')
c.record(action)
c.setCount(2)
self.failIf(action.playbackPolicy.hasBeenPlayedBack)
self.failIf(action.playbackPolicy.isReadyForRemoval)
c.playback(action)
self.failIf(action.playbackPolicy.hasBeenPlayedBack)
self.failIf(action.playbackPolicy.isReadyForRemoval)
c.playback(action)
self.failUnless(action.playbackPolicy.hasBeenPlayedBack)
self.failUnless(action.playbackPolicy.isReadyForRemoval)
示例3: testSpecifyingMultiCounts
# 需要導入模塊: from pymock import Controller [as 別名]
# 或者: from pymock.Controller import setCount [as 別名]
def testSpecifyingMultiCounts(self):
"""Specify multi counts for a single argument"""
c = Controller()
x = c.mock(KlassBeingMocked)
x.w = 5
c.setCount(2)
c.replay()
x.w = 5
x.w = 5
try:
x.w = 5
self.fail()
except PlaybackFailure, e:
pass