| 36 | ("mat1", "mat2"), [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)] |
| 37 | ) |
| 38 | def test_addition(mat1, mat2): |
| 39 | if (np.array(mat1)).shape < (2, 2) or (np.array(mat2)).shape < (2, 2): |
| 40 | logger.info(f"\n\t{test_addition.__name__} returned integer") |
| 41 | with pytest.raises(TypeError): |
| 42 | matop.add(mat1, mat2) |
| 43 | elif (np.array(mat1)).shape == (np.array(mat2)).shape: |
| 44 | logger.info(f"\n\t{test_addition.__name__} with same matrix dims") |
| 45 | act = (np.array(mat1) + np.array(mat2)).tolist() |
| 46 | theo = matop.add(mat1, mat2) |
| 47 | assert theo == act |
| 48 | else: |
| 49 | logger.info(f"\n\t{test_addition.__name__} with different matrix dims") |
| 50 | with pytest.raises(ValueError): |
| 51 | matop.add(mat1, mat2) |
| 52 | |
| 53 | |
| 54 | @pytest.mark.mat_ops |