def _make_list(self, f): if len(f.get_root_node().get_children()) == 0: nh= f.get_root_node().add_child("testn", RMF.REPRESENTATION) else: nh = f.get_root_node().get_children()[0] lst=[(f.get_int_key, 4), (f.get_float_key, 3.1415), (f.get_node_id_key, nh.get_id()), (f.get_node_ids_key, [nh.get_id()]), (f.get_string_key, "there"), (f.get_index_key, 3), (f.get_ints_key, [3,4,5,6])] self.assertEqual(len(lst),len(RMF.get_data_types())-3) return lst
def _do_test_types(self, f, pccc): nh= f.get_root_node().add_child("testn", RMF.REPRESENTATION) cat= f.add_category("mine"+str(pccc)) #g= f.get_hdf5_group() #print g #ds= g.add_child_float_data_set_2d("ds"+str(pccc)) #dsi= g.add_child_index_data_set_2d("dsi"+str(pccc)) lst=[(f.add_int_key, 4), (f.add_float_key, 3.1415), (f.add_node_id_key, nh.get_id()), (f.add_node_ids_key, [nh.get_id()]), (f.add_string_key, "there"), (f.add_index_key, 3), (f.add_ints_key, [3,4,5,6])] self.assertEqual(len(lst),len(RMF.get_data_types())-3) for p in lst: print p[0] k = p[0](cat, "hi", pccc) self._do_test_type(nh, k, p[1])
def _do_touch_types(self, f, pccc): nh= RMF.NodeID(0) ds= f.add_child_float_data_set_2d("ds"+str(pccc)) dsi= f.add_child_index_data_set_2d("dsi"+str(pccc)) lst=[(f.add_child_int_data_set_1d, 4), (f.add_child_float_data_set_1d, 3.1415), (f.add_child_node_id_data_set_1d, nh), (f.add_child_string_data_set_1d, "there"), (f.add_child_index_data_set_1d, 3), #(f.add_child_float_data_set_2d_data_set_1d, ds), #(f.add_child_index_data_set_2d_data_set_1d, dsi), (f.add_child_ints_data_set_1d, [3,4,5,6]), #(f.add_child_node_ids_data_set_1d, [nh]), ] # swig can't get the node ids array right self.assertEqual(len(lst),len(RMF.get_data_types())-4) for i,p in enumerate(lst): mds=p[0](str(i)) mds.set_size([1]) mds.set_value([0], p[1]) vo= mds.get_value([0]) self.assertEqual(vo, p[1])