def test_can_return_unaltered_minors(self): matrix = Matrix([1, 2, 3], [4, 5, 6], [7, 8, 9]) self.assertEqual(matrix.cofactor(0, 0), 5) self.assertEqual(matrix.cofactor(0, 2), 5) self.assertEqual(matrix.cofactor(1, 1), 5) self.assertEqual(matrix.cofactor(2, 0), 5) self.assertEqual(matrix.cofactor(2, 0), 5)
def test_can_return_negative_minors(self): matrix = Matrix([1, 2, 3], [4, 5, 6], [7, 8, 9]) self.assertEqual(matrix.cofactor(0, 1), -5) self.assertEqual(matrix.cofactor(1, 0), -5) self.assertEqual(matrix.cofactor(1, 2), -5) self.assertEqual(matrix.cofactor(2, 1), -5)