Esempio n. 1
0
    def test_no_loop(self):

        items = [
            ('1', 1),
            ('2', 1),
            ('3', 1),
        ]

        r = Randomizer(items)
        r.loop = False

        x = 0
        for _ in r:
            x += 1

        self.assertEqual(3, x)
Esempio n. 2
0
    def test_no_loop_no_random(self):

        items = [
            ('1', 1),
            ('2', 1),
            ('3', 1),
        ]

        for _ in range(50):

            r = Randomizer(items)
            r.loop = False
            r.disable_random = True

            x = 0
            for i, result in enumerate(r):
                x += 1
                self.assertEqual(items[i][0], result)

            self.assertEqual(3, x)