mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-24 01:48:39 +00:00
fix test file issues
This commit is contained in:
parent
792ee57123
commit
598359efa5
@ -1,10 +1,8 @@
|
|||||||
import unittest
|
import pytest
|
||||||
from strassen_matrix_multiplication import split_matrix
|
from divide_and_conquer.strassen_matrix_multiplication import split_matrix
|
||||||
|
|
||||||
|
|
||||||
class TestSplitMatrix(unittest.TestCase):
|
def test_4x4_matrix():
|
||||||
|
|
||||||
def test_4x4_matrix(self):
|
|
||||||
matrix = [
|
matrix = [
|
||||||
[4, 3, 2, 4],
|
[4, 3, 2, 4],
|
||||||
[2, 3, 1, 1],
|
[2, 3, 1, 1],
|
||||||
@ -17,9 +15,10 @@ class TestSplitMatrix(unittest.TestCase):
|
|||||||
[[6, 5], [8, 4]],
|
[[6, 5], [8, 4]],
|
||||||
[[4, 3], [1, 6]]
|
[[4, 3], [1, 6]]
|
||||||
)
|
)
|
||||||
self.assertEqual(split_matrix(matrix), expected)
|
assert split_matrix(matrix) == expected
|
||||||
|
|
||||||
def test_8x8_matrix(self):
|
|
||||||
|
def test_8x8_matrix():
|
||||||
matrix = [
|
matrix = [
|
||||||
[4, 3, 2, 4, 4, 3, 2, 4],
|
[4, 3, 2, 4, 4, 3, 2, 4],
|
||||||
[2, 3, 1, 1, 2, 3, 1, 1],
|
[2, 3, 1, 1, 2, 3, 1, 1],
|
||||||
@ -36,26 +35,26 @@ class TestSplitMatrix(unittest.TestCase):
|
|||||||
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]],
|
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]],
|
||||||
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]]
|
[[4, 3, 2, 4], [2, 3, 1, 1], [6, 5, 4, 3], [8, 4, 1, 6]]
|
||||||
)
|
)
|
||||||
self.assertEqual(split_matrix(matrix), expected)
|
assert split_matrix(matrix) == expected
|
||||||
|
|
||||||
def test_invalid_odd_matrix(self):
|
|
||||||
|
def test_invalid_odd_matrix():
|
||||||
matrix = [
|
matrix = [
|
||||||
[1, 2, 3],
|
[1, 2, 3],
|
||||||
[4, 5, 6],
|
[4, 5, 6],
|
||||||
[7, 8, 9]
|
[7, 8, 9]
|
||||||
]
|
]
|
||||||
with self.assertRaises(Exception):
|
with pytest.raises(Exception, match="Odd matrices are not supported!"):
|
||||||
split_matrix(matrix)
|
split_matrix(matrix)
|
||||||
|
|
||||||
def test_invalid_non_square_matrix(self):
|
|
||||||
|
def test_invalid_non_square_matrix():
|
||||||
matrix = [
|
matrix = [
|
||||||
[1, 2, 3, 4],
|
[1, 2, 3, 4],
|
||||||
[5, 6, 7, 8],
|
[5, 6, 7, 8],
|
||||||
[9, 10, 11, 12]
|
[9, 10, 11, 12],
|
||||||
|
[13, 14, 15, 16],
|
||||||
|
[17, 18, 19, 20]
|
||||||
]
|
]
|
||||||
with self.assertRaises(Exception):
|
with pytest.raises(Exception, match="Odd matrices are not supported!"):
|
||||||
split_matrix(matrix)
|
split_matrix(matrix)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user