Ejemplo n.º 1
0
    def test_shuffle(self):
        data = [([], []), ([1], []), ([1, 2], [(1, 2)]),
                ([1, 2, 3], [(1, 2), (1, 3), (2, 3)]),
                ([1, 2, 3, 4], [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4),
                                (3, 4)])]

        def tuple_sort(t):
            return tuple(sorted(list(t)))

        for input, output in data:
            d = roundrobin.initial_state(input)
            d = [tuple_sort(x) for x in d]
            output = [tuple_sort(x) for x in output]
            assert len(d) == len(output)
            assert set(d) == set(output)
Ejemplo n.º 2
0
    def test_shuffle(self):
        data = [
            ([], []),
            ([1], []),
            ([1, 2], [(1, 2)]),
            ([1, 2, 3], [(1, 2), (1, 3), (2, 3)]),
            ([1, 2, 3, 4], [(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)])
        ]

        def tuple_sort(t):
            return tuple(sorted(list(t)))

        for input, output in data:
            d = roundrobin.initial_state(input)
            d = [tuple_sort(x) for x in d]
            output = [tuple_sort(x) for x in output]
            assert len(d) == len(output)
            assert set(d) == set(output)