Beispiel #1
0
def main():
    m1 = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    m2 = [[6, 5, 0], [1, 3, 9], [0, 2, 1]]
    print(matrices.add_matrices(m1, m2))
    print(matrices.sub_matrices(m1, m2))
    print(figures.square_area(2))
    print(figures.triangle_area(6, 3))
Beispiel #2
0
def test_sub_matrices():
    A = [
        [1, 2, 3],
        [4, 5, 6],
    ]
    B = [
        [7, 8, 9],
        [10, 11, 12],
    ]
    result = sub_matrices(A, B)
    assert result == [[-6, -6, -6], [-6, -6, -6]]
def test_sub_matrices_with_diffrent_count_of_rows():
    a = [
        [1, 2],
        [3, 4],
        [5, 6],
    ]

    b = [
        [7, 8, 9],
        [10, 11, 12],
    ]
    with pytest.raises(ValueError) as e:
        result = sub_matrices(a, b)
def test2():

    a = [
        [1,2,3],
        [4,5,6],
    ]

    b = [
        [7,8,9],
        [10,11,12],
    ]
    result = sub_matrices(a,b)

    assert result == [
        [-6,-6,-6],
        [-6,-6,-6],
    ]
Beispiel #5
0
def test_sub_matrices_with_different_count_of_rows():
    A = [
        [1, 2],
        [3, 4],
        [3, 4],
    ]

    B = [
        [7, 8],
        [10, 11],
    ]

    with pytest.raises(
            ValueError
    ):  # test sprawdza czy błąd zostanie rzuciony, zaimpoortowqaliśmy do tego pytest
        result = sub_matrices(A, B)


# poszukaj co nie działa
def test_sub_matrices():
    X = [
        [1, 2, 3],
        [4, 5, 6],
    ]

    Y = [
        [
            7,
            8,
            9,
        ],
        [10, 11, 12],
    ]

    result = sub_matrices(X, Y)
    assert result == [
        [-6, -6, -6],
        [-6, -6, -6],
    ]
Beispiel #7
0
def test_sub_matriece():
    a = [[1, 2, 3], [1, 2, 3]]
    b = [[1, 2, 3], [1, 2, 3]]
    result = sub_matrices(a, b)
    expected = [[0, 0, 0], [0, 0, 0]]
    result == expected
Beispiel #8
0
def test_odejmowanie_matryc():
    assert matrices.sub_matrices([1, 2, 3], [3, 2, 6]) == [1, 6]
def test_sub_matrices():
    assert sub_matrices(b, a) == [[4, 4], [4, 4]]