def test_io_1(self): "io_general" io = IO(self.filename) x = larry([1,2,3]) io['x'] = x self.assertTrue('x' in io, 'key missing') self.assertTrue((x == io['x'][:]).all(), 'save and load difference') self.assertTrue(['x'] == io.keys(), 'keys are different') self.assertTrue(x.dtype == io['x'].dtype, 'dtype changed') del io['x'] self.assertTrue(io.keys() == [], 'key still present')
def test_io_1(self): "io_general" io = IO(self.filename) x = larry([1, 2, 3]) io["x"] = x self.assert_("x" in io, "key missing") self.assert_((x == io["x"][:]).all(), "save and load difference") self.assert_(["x"] == io.keys(), "keys are different") self.assert_(x.dtype == io["x"].dtype, "dtype changed") del io["x"] self.assert_(io.keys() == [], "key still present")
def test_io_1(self): "io_general" io = IO(self.filename) x = larry([1, 2, 3]) io['x'] = x self.assertTrue('x' in io, 'key missing') self.assertTrue((x == io['x'][:]).all(), 'save and load difference') self.assertTrue(['x'] == list(io.keys()), 'keys are different') self.assertTrue(x.dtype == io['x'].dtype, 'dtype changed') del io['x'] self.assertTrue(list(io.keys()) == [], 'key still present')
def test_io_3(self): "io_keys" io = IO(self.filename) io["1"] = larry([1, 2, 3]) io["2"] = larry([1, 2, 3]) io.f["3"] = [1, 2, 3] io["1/2/3/4"] = larry([1, 2, 3]) keys = io.keys() keys.sort() theory = ["1", "1/2/3/4", "2"] self.assert_(keys == theory, "keys do not match")
def test_io_3(self): "io_keys" io = IO(self.filename) io['1'] = larry([1,2,3]) io['2'] = larry([1,2,3]) io.f['3'] = [1,2,3] io['1/2/3/4'] = larry([1,2,3]) keys = io.keys() keys.sort() theory = ['1', '1/2/3/4', '2'] self.assertTrue(keys == theory, 'keys do not match')
def test_io_3(self): "io_keys" io = IO(self.filename) io['1'] = larry([1, 2, 3]) io['2'] = larry([1, 2, 3]) io.f['3'] = [1, 2, 3] io['1/2/3/4'] = larry([1, 2, 3]) keys = io.keys() keys.sort() theory = ['1', '1/2/3/4', '2'] self.assert_(keys == theory, 'keys do not match')
def test_io_3(self): "io_keys" io = IO(self.filename) io['1'] = larry([1, 2, 3]) io['2'] = larry([1, 2, 3]) f = h5py.File(self.filename) f['3'] = [1, 2, 3] f.close() io['1/2/3/4'] = larry([1, 2, 3]) keys = list(io.keys()) keys.sort() theory = ['1', '1/2/3/4', '2'] self.assertTrue(keys == theory, 'keys do not match')
def test_io_3(self): "io_keys" io = IO(self.filename) io['1'] = larry([1,2,3]) io['2'] = larry([1,2,3]) f = h5py.File(self.filename) f['3'] = [1,2,3] f.close() io['1/2/3/4'] = larry([1,2,3]) keys = list(io.keys()) keys.sort() theory = ['1', '1/2/3/4', '2'] self.assertTrue(keys == theory, 'keys do not match')