mirror of https://github.com/m-labs/artiq.git
master/databases: fix AttributeError in DatasetDB.set()
Add corresponding unit test. Signed-off-by: Etienne Wodey <wodey@iqo.uni-hannover.de>
This commit is contained in:
parent
d8b1e59538
commit
12ef907f34
|
@ -90,7 +90,7 @@ class DatasetDB(TaskObject):
|
|||
def set(self, key, value, persist=None, **hdf5_options):
|
||||
if persist is None:
|
||||
if key in self.data.raw_view:
|
||||
persist = self.data.raw_view[key].persist
|
||||
persist = self.data.raw_view[key]["persist"]
|
||||
else:
|
||||
persist = False
|
||||
self.data[key] = make_dataset(
|
||||
|
|
|
@ -97,3 +97,15 @@ class TestDatasetDB(unittest.TestCase):
|
|||
|
||||
self.ddb.update(mod)
|
||||
self.assertFalse(self.ddb.get(KEY1)["hdf5_options"]["shuffle"])
|
||||
|
||||
def test_reset_copies_persist(self):
|
||||
self.assertTrue(self.ddb.get(KEY1)["persist"])
|
||||
self.ddb.set(KEY1, DATA)
|
||||
self.assertTrue(self.ddb.get(KEY1)["persist"])
|
||||
|
||||
self.assertFalse(self.ddb.get(KEY3)["persist"])
|
||||
self.ddb.set(KEY3, DATA)
|
||||
self.assertFalse(self.ddb.get(KEY3)["persist"])
|
||||
|
||||
self.ddb.set(KEY3, DATA, persist=True)
|
||||
self.assertTrue(self.ddb.get(KEY3)["persist"])
|
||||
|
|
Loading…
Reference in New Issue