コード例 #1
0
def test_remove_nth():
    l = [1, 3, 4, 5, 34, 67, -34, -4]
    assert func.remove_nth(l, 2) == [3, 5, 67, -4]
    assert func.remove_nth(l) == func.remove_nth(l, 2)
    assert func.remove_nth(l, 1) == []
    # the next assertion fails as the list, 
    # previously altered by the other operations is already empty
    # we can either perform the check with the original list or change 
    # the expected value
    l = [1, 3, 4, 5, 34, 67, -34, -4]
    assert func.remove_nth(l, nth=3) == [3, 4, 34, 67, -4]
コード例 #2
0
ファイル: test_functions.py プロジェクト: skaser/Exercise-1
def test_remove_nth():
    l = [1, 3, 4, 5, 34, 67, -34, -4]
    assert func.remove_nth(l, 2) == [3, 5, 67, -4]
    assert func.remove_nth(l) == func.remove_nth(l, 2)
    assert func.remove_nth(l, 1) == []
    assert func.remove_nth(l, nth=3) == [3, 4, 34, 67, -4]