Beispiel #1
0
    def test_cycle(self):
        resources = ['a', 'b', 'c', 'd', 'e']

        def echo(r, timeout=None):
            return r

        # cycle should be ['a', 'b', 'c', 'd', 'e', ... repeat]
        cycle = FairCycle(echo, resources, MyEmpty)
        for i in range(len(resources)):
            self.assertEqual(cycle.get(), (resources[i], resources[i]))
        for i in range(len(resources)):
            self.assertEqual(cycle.get(), (resources[i], resources[i]))
Beispiel #2
0
    def test_cycle(self):
        resources = ['a', 'b', 'c', 'd', 'e']
        callback = Mock(name='callback')

        def echo(r, timeout=None):
            return r

        # cycle should be ['a', 'b', 'c', 'd', 'e', ... repeat]
        cycle = FairCycle(echo, resources, MyEmpty)
        for i in range(len(resources)):
            assert cycle.get(callback) == resources[i]
        for i in range(len(resources)):
            assert cycle.get(callback) == resources[i]
Beispiel #3
0
    def test_cycle(self):
        resources = ['a', 'b', 'c', 'd', 'e']
        callback = Mock(name='callback')

        def echo(r, timeout=None):
            return r

        # cycle should be ['a', 'b', 'c', 'd', 'e', ... repeat]
        cycle = FairCycle(echo, resources, MyEmpty)
        for i in range(len(resources)):
            assert cycle.get(callback) == resources[i]
        for i in range(len(resources)):
            assert cycle.get(callback) == resources[i]
Beispiel #4
0
    def test_cycle(self):
        resources = ['a', 'b', 'c', 'd', 'e']

        def echo(r, timeout=None):
            return r

        # cycle should be ['a', 'b', 'c', 'd', 'e', ... repeat]
        cycle = FairCycle(echo, resources, MyEmpty)
        for i in range(len(resources)):
            self.assertEqual(cycle.get(), (resources[i],
                                           resources[i]))
        for i in range(len(resources)):
            self.assertEqual(cycle.get(), (resources[i],
                                           resources[i]))