Exemplo n.º 1
0
 def test_repeat_all(self):
     """ Control.repeat() should be like str(Control()) * count. """
     count = 3
     s = ''.join((
         str(move.up()),
         str(move.down()),
         str(move.down()),
         str(move.down()),
     )) * count
     ctl = Control().move_up().move_down().repeat(3)
     self.assertEqual(
         s,
         str(ctl.repeat_all(count)),
         msg='Control.repeat_all produced an unexpected result.',
     )
Exemplo n.º 2
0
    def test_repeat_all(self):
        """ Control.repeat() should be like str(Control()) * count. """
        count = 3
        s = ''.join((
            str(move.up()),
            str(move.down()),
            str(move.down()),
            str(move.down()),
        )) * count
        ctl = Control().move_up().move_down().repeat(3)
        self.assertEqual(
            s,
            str(ctl.repeat_all(count)),
            msg='Control.repeat_all produced an unexpected result.',
        )

        # Non-integer count should raise.
        with self.assertRaises(TypeError):
            Control().repeat_all(count='BAD')