示例#1
0
class incTurns(unittest.TestCase):
    """ Test cases of incTurns """
    def setUp(self):
        """ Build the Delegate for the test """
        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns

    def inc(self):
        """ Test that the turnOn is incremented """
        self.delegate.turnOn = 0
        self.delegate.incTurns()

        assert self.delegate.turnOn == 1, "Turn should be incremented"

    def wrapAround(self):
        """ Test that the turnOn wraps around to 0 when it hits the turn count """
        self.delegate.turnOn = self.turns - 1
        self.delegate.incTurns()

        assert self.delegate.turnOn == 0, "Turn should wrap around to 0"
示例#2
0
class incTurns(unittest.TestCase):
    """ Test cases of incTurns """
    
    def  setUp(self):
        """ Build the Delegate for the test """
        self.turns = 2
        self.delegate = MultiTurnDelegate(None)
        self.delegate.turns = self.turns
        
    def inc(self):
        """ Test that the turnOn is incremented """
        self.delegate.turnOn = 0
        self.delegate.incTurns()
        
        assert self.delegate.turnOn == 1, "Turn should be incremented"
        
    def wrapAround(self):
        """ Test that the turnOn wraps around to 0 when it hits the turn count """
        self.delegate.turnOn = self.turns - 1
        self.delegate.incTurns()
        
        assert self.delegate.turnOn == 0, "Turn should wrap around to 0"