def test_copy_storageNumpyVolatile(self): #''' #Test that a copy of a StorageNumpy does not share memory (Volatile version) #''' n=np.arange(12).reshape(3,4) s=StorageNumpy(n) c=s.copy() self.assertTrue(s.storage_id is None) self.assertTrue(c.storage_id is None) self.assertTrue(c[0,0]==s[0,0]) c[0,0]=42 self.assertTrue(c[0,0]!=s[0,0])
def test_copy_storageNumpyPersist(self): #''' #Test that a copy of a StorageNumpy does not share memory (Persistent version) #''' n=np.arange(12).reshape(3,4) s=StorageNumpy(n,"test_copy_storageNumpyPersist") c=s.copy() self.assertTrue(c.storage_id is None) self.assertTrue(c._get_name() is None) self.assertTrue(c[0,0]==s[0,0]) c[0,0]=42 self.assertTrue(c[0,0]!=s[0,0]) # Clean up s.delete_persistent()