Exemplo n.º 1
0
def test_problem2_05():
    s = set(range(0, 5, 2))
    n = 1
    expect = {(2,), (0,), (4,)}
    result = quiz.all_consecutives(s, n)
    assert expect == result

    s = set(range(0, 5, 2))
    n = 2
    expect = set()
    result = quiz.all_consecutives(s, n)
    assert expect == result
Exemplo n.º 2
0
def test_problem2_07():
    # big set
    s1 = list(range(50)); r1 = {(a,b,c) for a,b,c in zip(s1,s1[1:],s1[2:])}
    s2 = list(range(200,300,2)); r2 = set()
    s3 = list(range(100,150)); r3 = {(a,b,c) for a,b,c in zip(s3,s3[1:],s3[2:])}
    s = set(s1) | set(s2) | set(s3)
    n = 3
    expect = r1 | r2 | r3
    result = quiz.all_consecutives(s, n)
    assert expect == result
Exemplo n.º 3
0
def test_problem2_04():
    s = set(range(5))
    n = 6
    expect = set()
    result = quiz.all_consecutives(s, n)
    assert expect == result
Exemplo n.º 4
0
def test_problem2_03():
    s = set(range(5))
    n = 5
    expect = {(0, 1, 2, 3, 4)}
    result = quiz.all_consecutives(s, n)
    assert expect == result
Exemplo n.º 5
0
def test_problem2_02():
    s = set(range(5))
    n = 2
    expect = {(0, 1), (3, 4), (2, 3), (1, 2)}
    result = quiz.all_consecutives(s, n)
    assert expect == result
Exemplo n.º 6
0
def test_problem2_01():
    s = set(range(5))
    n = 1
    expect = {(0,), (1,), (2,), (3,), (4,)}
    result = quiz.all_consecutives(s, n)
    assert expect == result
Exemplo n.º 7
0
def test_problem2_06():
    s = {0, 83, 2, 3, 81, 7, 82}
    n = 2
    expect = {(81, 82), (2, 3), (82, 83)}
    result = quiz.all_consecutives(s, n)
    assert expect == result