MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / test_multiplication

Function test_multiplication

matrix/tests/test_matrix_operation.py:78–93  ·  view source on GitHub ↗
(mat1, mat2)

Source from the content-addressed store, hash-verified

76 ("mat1", "mat2"), [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]
77)
78def test_multiplication(mat1, mat2):
79 if (np.array(mat1)).shape < (2, 2) or (np.array(mat2)).shape < (2, 2):
80 logger.info(f"\n\t{test_multiplication.__name__} returned integer")
81 with pytest.raises(TypeError):
82 matop.add(mat1, mat2)
83 elif (np.array(mat1)).shape == (np.array(mat2)).shape:
84 logger.info(f"\n\t{test_multiplication.__name__} meets dim requirements")
85 act = (np.matmul(mat1, mat2)).tolist()
86 theo = matop.multiply(mat1, mat2)
87 assert theo == act
88 else:
89 logger.info(
90 f"\n\t{test_multiplication.__name__} does not meet dim requirements"
91 )
92 with pytest.raises(ValueError):
93 assert matop.subtract(mat1, mat2)
94
95
96@pytest.mark.mat_ops

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected