Пример #1
0
 def test_load_namespace_with_reftype_attribute_check_autoclass_const(self):
     ns_builder = NWBNamespaceBuilder('Extension for use in my Lab',
                                      self.prefix)
     test_ds_ext = NWBDatasetSpec(
         doc='test dataset to add an attr',
         name='test_data',
         shape=(None, ),
         attributes=[
             NWBAttributeSpec(name='target_ds',
                              doc='the target the dataset applies to',
                              dtype=RefSpec('TimeSeries', 'object'))
         ],
         neurodata_type_def='my_new_type')
     ns_builder.add_spec(self.ext_source, test_ds_ext)
     ns_builder.export(self.ns_path, outdir=self.tempdir)
     type_map = get_type_map(
         extensions=os.path.join(self.tempdir, self.ns_path))
     my_new_type = type_map.get_container_cls(self.prefix, 'my_new_type')
     docval = None
     for tmp in get_docval(my_new_type.__init__):
         if tmp['name'] == 'target_ds':
             docval = tmp
             break
     self.assertIsNotNone(docval)
     self.assertEqual(docval['type'], TimeSeries)
Пример #2
0
 def test_load_namespace_with_reftype_attribute(self):
     ns_builder = NWBNamespaceBuilder('Extension for use in my Lab', self.prefix)
     test_ds_ext = NWBDatasetSpec(doc='test dataset to add an attr',
                                  name='test_data', shape=(None,),
                                  attributes=[NWBAttributeSpec(name='target_ds',
                                                               doc='the target the dataset applies to',
                                                               dtype=RefSpec('TimeSeries', 'object'))],
                                  neurodata_type_def='my_new_type')
     ns_builder.add_spec(self.ext_source, test_ds_ext)
     ns_builder.export(self.ns_path, outdir=self.tempdir)
     get_type_map(extensions=os.path.join(self.tempdir, self.ns_path))