Exemple #1
0
 def test_property_change(self):
     """ Make sure all attributes are saved properly after the change, 
     including quantities, units, types etc."""
     iom = NeoHdf5IO(filename=self.test_file)
     for obj_type in class_by_name.keys():
         obj = fake_NEO(obj_type, cascade=False)
         iom.save(obj)
         self.assertTrue(hasattr(obj, "hdf5_path"))
         replica = iom.get(obj.hdf5_path, cascade=False)
         assert_objects_equivalent(obj, replica)
Exemple #2
0
 def test_property_change(self):
     """ Make sure all attributes are saved properly after the change,
     including quantities, units, types etc."""
     iom = NeoHdf5IO(filename=self.test_file)
     for obj_type in objectnames:
         obj = fake_neo(obj_type, cascade=False)
         iom.save(obj)
         self.assertTrue(hasattr(obj, "hdf5_path"))
         replica = iom.get(obj.hdf5_path, cascade=False)
         assert_objects_equivalent(obj, replica)
 def test_attr_changes(self):
     """ gets an object, changes its attributes, saves it, then compares how
     good the changes were saved. """
     iom = NeoHdf5IO(filename=self.test_file)
     for obj_type in objectnames:
         obj = fake_neo(obj_type=obj_type, cascade=False)
         iom.save(obj)
         orig_obj = iom.get(obj.hdf5_path)
         for attr in obj._all_attrs:
             if hasattr(orig_obj, attr[0]):
                 setattr(obj, attr[0], get_fake_value(*attr))
         iom.save(orig_obj)
         test_obj = iom.get(orig_obj.hdf5_path)
         assert_objects_equivalent(orig_obj, test_obj)
Exemple #4
0
 def test_attr_changes(self):
     """ gets an object, changes its attributes, saves it, then compares how
     good the changes were saved. """
     iom = NeoHdf5IO(filename=self.test_file)
     for obj_type in objectnames:
         obj = fake_neo(obj_type=obj_type, cascade=False)
         iom.save(obj)
         orig_obj = iom.get(obj.hdf5_path)
         for attr in obj._all_attrs:
             if hasattr(orig_obj, attr[0]):
                 setattr(obj, attr[0], get_fake_value(*attr))
         iom.save(orig_obj)
         test_obj = iom.get(orig_obj.hdf5_path)
         assert_objects_equivalent(orig_obj, test_obj)
Exemple #5
0
 def test_attr_changes(self):
     """ gets an object, changes its attributes, saves it, then compares how
     good the changes were saved. """
     iom = NeoHdf5IO(filename=self.test_file)
     for obj_type in class_by_name.keys():
         obj = fake_NEO(obj_type = obj_type, cascade = False)
         iom.save(obj)
         orig_obj = iom.get(obj.hdf5_path)
         attrs = classes_necessary_attributes[obj_type] + classes_recommended_attributes[obj_type]
         for attr in attrs:
             if hasattr(orig_obj, attr[0]):
                 setattr(obj, attr[0], get_fake_value(attr))
         iom.save(orig_obj)
         test_obj = iom.get(orig_obj.hdf5_path)
         assert_objects_equivalent(orig_obj, test_obj)