示例#1
0
def test_mult(random_chk=1000):
    for _ in range(random_chk):
        a = []
        b = []
        final_len = no_dup = randint(2, 100)
        for i in range(no_dup):
            a.append(i)
            b.append(i)
            repeat = randint(0, 5)
            if repeat != 0:
                a.extend([i] * repeat)
                b.extend([i])
                final_len += 1
        assert rm_dups(a) == final_len
        assert a[:final_len] == b[:final_len]
示例#2
0
def test_one():
    assert rm_dups([1]) == 1
示例#3
0
def test_four_2():
    a = [1, 1, 1, 2]
    assert rm_dups(a) == 3
示例#4
0
def test_four_1():
    a = [1, 1, 2, 2]
    assert rm_dups(a) == 4
示例#5
0
def test_three_same():
    a = [1, 1, 1]
    assert rm_dups(a) == 2
示例#6
0
def test_empty():
    assert rm_dups([]) == 0
示例#7
0
def test_three():
    a = [1, 1, 2]
    assert rm_dups(a) == 3
示例#8
0
def test_two_diff():
    assert rm_dups([1, 2]) == 2
示例#9
0
def test_two_same():
    assert rm_dups([1, 1]) == 2