Пример #1
0
def test_cartesian_product_downturn():
    """empty product"""
    # run test
    paths = cartesian_product()

    # check
    assert paths == []
Пример #2
0
def test_cartesian_product_downturn():
    """empty product"""
    # run test
    paths = cartesian_product()

    # check
    assert paths == []
Пример #3
0
def test_cartesian_product_endorse():
    """cartesian product of strings"""
    # run test
    paths = cartesian_product(['A', 'B', 'C'], ['a', 'b', 'c'], 'f')

    # check
    assert set(str(p) for p in paths) == set([
        'A/a/f', 'A/b/f', 'A/c/f',
        'B/a/f', 'B/b/f', 'B/c/f',
        'C/a/f', 'C/b/f', 'C/c/f',
    ])
Пример #4
0
def test_cartesian_product_negative():
    """cartesian product of paths"""
    # run test
    paths = cartesian_product(
        [to_path('A'), to_path('B'), to_path('C')],
        ['a', 'b', 'c'],
        'f'
    )

    # check
    assert set(str(p) for p in paths) == set([
        'A/a/f', 'A/b/f', 'A/c/f',
        'B/a/f', 'B/b/f', 'B/c/f',
        'C/a/f', 'C/b/f', 'C/c/f',
    ])
Пример #5
0
def test_cartesian_product_endorse():
    """cartesian product of strings"""
    # run test
    paths = cartesian_product(["A", "B", "C"], ["a", "b", "c"], "f")

    # check
    assert set(str(p) for p in paths) == set([
        "A/a/f",
        "A/b/f",
        "A/c/f",
        "B/a/f",
        "B/b/f",
        "B/c/f",
        "C/a/f",
        "C/b/f",
        "C/c/f",
    ])
Пример #6
0
def test_cartesian_product_negative():
    """cartesian product of paths"""
    # run test
    paths = cartesian_product(
        [to_path("A"), to_path("B"), to_path("C")], ["a", "b", "c"], "f")

    # check
    assert set(str(p) for p in paths) == set([
        "A/a/f",
        "A/b/f",
        "A/c/f",
        "B/a/f",
        "B/b/f",
        "B/c/f",
        "C/a/f",
        "C/b/f",
        "C/c/f",
    ])