Example #1
0
def test_multiply_array_with_integer():
    arr = Array((5,), 1, 3, 9, 5, 2)
    num = 2

    new_array = arr * num

    assert new_array == (2, 6, 18, 10, 4)
Example #2
0
def test_substract_array():
    arr = Array((5,), 1, 3, 9, 5, 2)
    arr2 = (3, 5, 2)

    new_array = arr - arr2

    assert new_array == (1, 9)
Example #3
0
def test_append_single_element():
    arr1 = Array((3,), 1, 2, 3)
    new_array = arr1 + (4,)

    assert new_array == (1, 2, 3, 4)
Example #4
0
def test_comparing_arrays():
    arr = Array((5,), 1, 3, 9, 5, 2)
    arr2 = Array((5,), 1, 3, 9, 5, 2)

    assert arr == arr2
Example #5
0
def test_if_print_returns_string():
    arr1 = Array((5,), 1, 2, 3, 4, 5)

    assert str(arr1) == "1 2 3 4 5"
Example #6
0
def test_substract_single_element():
    arr = Array((3,), 1, 3, 9)
    nr = 3
    new_array = arr - nr

    assert new_array == (1, 9)
Example #7
0
def test_append_array():
    arr1 = Array((3,), 1, 2, 3)
    arr2 = (4, 5, 6)
    new_array = arr1 + arr2

    assert new_array == (1, 2, 3, 4, 5, 6)