Пример #1
0
def test_insert_shift_array_single_element_list():
    assert insertShiftArray([2, 3, 4], 5) == [2, 3, 5, 4]
Пример #2
0
def test_insertShiftArray():
    assert shift_array.insertShiftArray([1, 2, 3, 4], 6) == [1, 2, 6, 3, 4]
    assert shift_array.insertShiftArray([5, 4, 3, 2, 1],
                                        10) == [5, 4, 10, 3, 2, 1]
    assert shift_array.insertShiftArray([1, 10], 5) == [1, 5, 10]
Пример #3
0
def test_type_error():
    """when TypeError occurs"""
    with pytest.raises(TypeError):
        insertShiftArray('a', 'b')
Пример #4
0
def test_insert_shift_array_pass():
    assert insertShiftArray([2, 4, 6, 8], 5) == [2, 4, 5, 6, 8]
def test_empty_insertShiftArray():
    assert sa.insertShiftArray([], 200) == [200]
def test_insertShiftArray():
    assert sa.insertShiftArray([1, 2, 3, 4], 5) == [1, 2, 5, 3, 4]
Пример #7
0
def test_pass_even_odd():
    """insert into odd sized list"""
    assert shift_array.insertShiftArray([1, 2, 3], 4) == [1, 2, 4, 3]
Пример #8
0
def test_pass_even():
    """insert into even sized list"""
    assert shift_array.insertShiftArray([1, 2, 3, 4], 5) == [1, 2, 5, 3, 4]
Пример #9
0
def test_fail():
    """correct error if not passed expected parameters"""
    with pytest.raises(TypeError) as err:
        shift_array.insertShiftArray(1, 'a')
    assert str(err.value) == 'Argument(s) invalid.'