Ejemplo n.º 1
0
 def test_SizedArray2_roundtrip(self):
     v2 = np.random.random_integers(0, 24, 50).reshape(
         (10, 5)).astype(np.int32)
     s = SizedArrayPtr_i(v2, "Round Trip")
     ref = v2
     tst = s.to_numpy()
     npt.assert_array_equal(ref, tst)
Ejemplo n.º 2
0
 def test_copy_from(self):
     v = self.v.copy()
     S = self.S.copy(True)
     X = SizedArrayPtr_i().alloc(S.size)
     npt.assert_array_equal(v, S.to_numpy())
     X.copy_from(S)
     npt.assert_array_equal(X.to_numpy(), S.to_numpy())
     npt.assert_array_equal(v, S.to_numpy())
Ejemplo n.º 3
0
 def test_roundtrip(self):
     s = SizedArrayPtr_i(self.v.copy(), "Round Trip")
     ref = self.v
     tst = s.to_numpy()
     npt.assert_array_equal(ref, tst)
Ejemplo n.º 4
0
 def setUp(self):
     self.scalar = 23
     self.v = np.ones(8, dtype=np.int32)
     self.v2 = self.v + 2
     self.S = SizedArrayPtr_i(self.v.copy())
     self.S2 = SizedArrayPtr_i(self.v2.copy())