def test_map_sub(self): a = MatrixPointer([1, 2, 3, 4], (2, 2)) b = MatrixPointer([4, 3, 2, 1], (2, 2)) c = a.map(lambda x, y: x - y, b) self.assertEqual(c, [-3, -1, 1, 3])
def test_map_sum(self): a = MatrixPointer([1, 2, 3, 4], (2, 2)) b = MatrixPointer([4, 3, 2, 1], (2, 2)) c = a.map(lambda x, y: x + y, b) self.assertEqual(c, [5]*4)