Beispiel #1
0
def _test_combinations_comm():
    assert set(allcombinations((1, 2, 3), (a, b), None)) == set((
        (((1, ), (2, 3)), ("a", "b")),
        (((2, ), (3, 1)), ("a", "b")),
        (((3, ), (1, 2)), ("a", "b")),
        (((1, 2), (3, )), ("a", "b")),
        (((2, 3), (1, )), ("a", "b")),
        (((3, 1), (2, )), ("a", "b")),
    ))
Beispiel #2
0
def test_allcombinations():
    assert set(allcombinations((1,2), (1,2), 'commutative')) ==\
        set(((((1,),(2,)), ((1,),(2,))), (((1,),(2,)), ((2,),(1,)))))
Beispiel #3
0
def _test_combinations_comm():
    assert set(allcombinations((1,2,3), (a,b), None)) == \
        set(((((1,), (2, 3)), ('a', 'b')), (((2,), (3, 1)), ('a', 'b')),
             (((3,), (1, 2)), ('a', 'b')), (((1, 2), (3,)), ('a', 'b')),
             (((2, 3), (1,)), ('a', 'b')), (((3, 1), (2,)), ('a', 'b'))))
Beispiel #4
0
def _test_combinations_assoc():
    assert set(allcombinations((1,2,3), (a,b), True)) == \
        set(((((1, 2), (3,)), (a, b)), (((1,), (2, 3)), (a, b))))
Beispiel #5
0
def test_allcombinations():
    assert set(allcombinations((1,2), (1,2), 'commutative')) ==\
        {(((1,),(2,)), ((1,),(2,))), (((1,),(2,)), ((2,),(1,)))}
Beispiel #6
0
def _test_combinations_comm():
    assert set(allcombinations((1,2,3), (a,b), None)) == \
        {(((1,), (2, 3)), ('a', 'b')), (((2,), (3, 1)), ('a', 'b')),
             (((3,), (1, 2)), ('a', 'b')), (((1, 2), (3,)), ('a', 'b')),
             (((2, 3), (1,)), ('a', 'b')), (((3, 1), (2,)), ('a', 'b'))}
Beispiel #7
0
def _test_combinations_assoc():
    assert set(allcombinations((1,2,3), (a,b), True)) == \
        {(((1, 2), (3,)), (a, b)), (((1,), (2, 3)), (a, b))}
Beispiel #8
0
def test_allcombinations():
    assert set(allcombinations((1, 2), (1, 2), "commutative")) == set(
        ((((1, ), (2, )), ((1, ), (2, ))), (((1, ), (2, )), ((2, ), (1, )))))