Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4ceb811

Browse files
committedJan 31, 2025·
Merge branch 'reduce_cyclomatic_complexity_of_split_matrix_function' of github.com:ivanz851/Algorithms-Python into reduce_cyclomatic_complexity_of_split_matrix_function
2 parents c1d7da9 + 034d970 commit 4ceb811

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed
 

‎divide_and_conquer/tests/test_strassen_matrix_multiplication.py

+6-20
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,8 @@
44

55

66
def test_4x4_matrix():
7-
matrix = [
8-
[4, 3, 2, 4],
9-
[2, 3, 1, 1],
10-
[6, 5, 4, 3],
11-
[8, 4, 1, 6]
12-
]
13-
expected = (
14-
[[4, 3], [2, 3]],
15-
[[2, 4], [1, 1]],
16-
[[6, 5], [8, 4]],
17-
[[4, 3], [1, 6]]
18-
)
7+
matrix = [[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]]
8+
expected = ([[4, 3], [2, 3]], [[2, 4], [1, 1]], [[6, 5], [8, 4]], [[4, 3], [1, 6]])
199
assert split_matrix(matrix) == expected
2010

2111

@@ -28,23 +18,19 @@ def test_8x8_matrix():
2818
[4, 3, 2, 4, 4, 3, 2, 4],
2919
[2, 3, 1, 1, 2, 3, 1, 1],
3020
[6, 5, 4, 3, 6, 5, 4, 3],
31-
[8, 4, 1, 6, 8, 4, 1, 6]
21+
[8, 4, 1, 6, 8, 4, 1, 6],
3222
]
3323
expected = (
3424
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]],
3525
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]],
3626
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]],
37-
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]]
27+
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]],
3828
)
3929
assert split_matrix(matrix) == expected
4030

4131

4232
def test_invalid_odd_matrix():
43-
matrix = [
44-
[1, 2, 3],
45-
[4, 5, 6],
46-
[7, 8, 9]
47-
]
33+
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
4834
with pytest.raises(Exception, match="Odd matrices are not supported!"):
4935
split_matrix(matrix)
5036

@@ -55,7 +41,7 @@ def test_invalid_non_square_matrix():
5541
[5, 6, 7, 8],
5642
[9, 10, 11, 12],
5743
[13, 14, 15, 16],
58-
[17, 18, 19, 20]
44+
[17, 18, 19, 20],
5945
]
6046
with pytest.raises(Exception, match="Odd matrices are not supported!"):
6147
split_matrix(matrix)

0 commit comments

Comments
 (0)
Please sign in to comment.