diff --git a/CHANGELOG.md b/CHANGELOG.md index fd3f2d3dd..319346a86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # HDMF Changelog +## HDMF 2.5.1 (April 23, 2021) + +### Bug fix +- Revert breaking change in `TypeMap.get_container_cls`. While this function is returned to its original behavior, + it will be modified at the next major release. Please use the new `TypeMap.get_dt_container_cls` instead. @rly (#590) + ## HDMF 2.5.0 (April 22, 2021) ### New features diff --git a/src/hdmf/build/classgenerator.py b/src/hdmf/build/classgenerator.py index d775722f0..55f7cc830 100644 --- a/src/hdmf/build/classgenerator.py +++ b/src/hdmf/build/classgenerator.py @@ -147,7 +147,7 @@ def _get_container_type(cls, type_name, type_map): """Search all namespaces for the container class associated with the given data type. Raises TypeDoesNotExistError if type is not found in any namespace. """ - container_type = type_map.get_container_cls(type_name) + container_type = type_map.get_dt_container_cls(type_name) if container_type is None: # pragma: no cover # this should never happen after hdmf#322 raise TypeDoesNotExistError("Type '%s' does not exist." % type_name) diff --git a/src/hdmf/build/manager.py b/src/hdmf/build/manager.py index b60d848b9..755246d82 100644 --- a/src/hdmf/build/manager.py +++ b/src/hdmf/build/manager.py @@ -475,30 +475,46 @@ def load_namespaces(self, **kwargs): for new_ns, ns_deps in deps.items(): for src_ns, types in ns_deps.items(): for dt in types: - container_cls = self.get_container_cls(dt, src_ns, autogen=False) + container_cls = self.get_dt_container_cls(dt, src_ns, autogen=False) if container_cls is None: container_cls = TypeSource(src_ns, dt) self.register_container_type(new_ns, dt, container_cls) return deps + @docval({"name": "namespace", "type": str, "doc": "the namespace containing the data_type"}, + {"name": "data_type", "type": str, "doc": "the data type to create a AbstractContainer class for"}, + {"name": "autogen", "type": bool, "doc": "autogenerate class if one does not exist", "default": True}, + returns='the class for the given namespace and data_type', rtype=type) + def get_container_cls(self, **kwargs): + """Get the container class from data type specification. + If no class has been associated with the ``data_type`` from ``namespace``, a class will be dynamically + created and returned. + """ + # NOTE: this internally used function get_container_cls will be removed in favor of get_dt_container_cls + namespace, data_type, autogen = getargs('namespace', 'data_type', 'autogen', kwargs) + return self.get_dt_container_cls(data_type, namespace, autogen) + @docval({"name": "data_type", "type": str, "doc": "the data type to create a AbstractContainer class for"}, {"name": "namespace", "type": str, "doc": "the namespace containing the data_type", "default": None}, {"name": "autogen", "type": bool, "doc": "autogenerate class if one does not exist", "default": True}, returns='the class for the given namespace and data_type', rtype=type) - def get_container_cls(self, **kwargs): + def get_dt_container_cls(self, **kwargs): """Get the container class from data type specification. If no class has been associated with the ``data_type`` from ``namespace``, a class will be dynamically created and returned. + + Replaces get_container_cls but namespace is optional. If namespace is unknown, it will be looked up from + all namespaces. """ namespace, data_type, autogen = getargs('namespace', 'data_type', 'autogen', kwargs) # namespace is unknown, so look it up if namespace is None: - for key, val in self.__container_types.items(): + for ns_key, ns_data_types in self.__container_types.items(): # NOTE that the type_name may appear in multiple namespaces based on how they were resolved # but the same type_name should point to the same class - if data_type in val: - namespace = key + if data_type in ns_data_types: + namespace = ns_key break cls = self.__get_container_cls(namespace, data_type) @@ -517,18 +533,18 @@ def __check_dependent_types(self, spec, namespace): def __check_dependent_types_helper(spec, namespace): if isinstance(spec, (GroupSpec, DatasetSpec)): if spec.data_type_inc is not None: - self.get_container_cls(spec.data_type_inc, namespace) # TODO handle recursive definitions + self.get_dt_container_cls(spec.data_type_inc, namespace) # TODO handle recursive definitions if spec.data_type_def is not None: - self.get_container_cls(spec.data_type_def, namespace) + self.get_dt_container_cls(spec.data_type_def, namespace) elif isinstance(spec, LinkSpec): if spec.target_type is not None: - self.get_container_cls(spec.target_type, namespace) + self.get_dt_container_cls(spec.target_type, namespace) if isinstance(spec, GroupSpec): for child_spec in (spec.groups + spec.datasets + spec.links): __check_dependent_types_helper(child_spec, namespace) if spec.data_type_inc is not None: - self.get_container_cls(spec.data_type_inc, namespace) + self.get_dt_container_cls(spec.data_type_inc, namespace) if isinstance(spec, GroupSpec): for child_spec in (spec.groups + spec.datasets + spec.links): __check_dependent_types_helper(child_spec, namespace) @@ -560,7 +576,7 @@ def __get_container_cls(self, namespace, data_type): return None ret = self.__container_types[namespace][data_type] if isinstance(ret, TypeSource): # data_type is a dependency from ret.namespace - cls = self.get_container_cls(ret.data_type, ret.namespace) # get class / generate class + cls = self.get_dt_container_cls(ret.data_type, ret.namespace) # get class / generate class # register the same class into this namespace (replaces TypeSource) self.register_container_type(namespace, data_type, cls) ret = cls @@ -619,7 +635,7 @@ def get_cls(self, **kwargs): namespace = self.get_builder_ns(builder) if namespace is None: raise ValueError("No namespace found for builder %s" % builder.path) - return self.get_container_cls(data_type, namespace) + return self.get_dt_container_cls(data_type, namespace) @docval({'name': 'spec', 'type': (DatasetSpec, GroupSpec), 'doc': 'the parent spec to search'}, {'name': 'builder', 'type': (DatasetBuilder, GroupBuilder, LinkBuilder), diff --git a/src/hdmf/common/__init__.py b/src/hdmf/common/__init__.py index aa861c057..b906fe7e7 100644 --- a/src/hdmf/common/__init__.py +++ b/src/hdmf/common/__init__.py @@ -101,6 +101,18 @@ def available_namespaces(): return __TYPE_MAP.namespace_catalog.namespaces +# a function to get the container class for a give type +@docval({'name': 'data_type', 'type': str, + 'doc': 'the data_type to get the Container class for'}, + {'name': 'namespace', 'type': str, 'doc': 'the namespace the data_type is defined in'}, + is_method=False) +def get_class(**kwargs): + """Get the class object of the Container subclass corresponding to a given neurdata_type. + """ + data_type, namespace = getargs('data_type', 'namespace', kwargs) + return __TYPE_MAP.get_dt_container_cls(data_type, namespace) + + # load the hdmf-common namespace __resources = __get_resources() if os.path.exists(__resources['namespace_path']): @@ -129,16 +141,16 @@ def available_namespaces(): raise RuntimeError("Unable to load a TypeMap - no namespace file found") -DynamicTable = __TYPE_MAP.get_container_cls('DynamicTable', CORE_NAMESPACE) -VectorData = __TYPE_MAP.get_container_cls('VectorData', CORE_NAMESPACE) -VectorIndex = __TYPE_MAP.get_container_cls('VectorIndex', CORE_NAMESPACE) -ElementIdentifiers = __TYPE_MAP.get_container_cls('ElementIdentifiers', CORE_NAMESPACE) -DynamicTableRegion = __TYPE_MAP.get_container_cls('DynamicTableRegion', CORE_NAMESPACE) -EnumData = __TYPE_MAP.get_container_cls('EnumData', EXP_NAMESPACE) -CSRMatrix = __TYPE_MAP.get_container_cls('CSRMatrix', CORE_NAMESPACE) -ExternalResources = __TYPE_MAP.get_container_cls('ExternalResources', EXP_NAMESPACE) -SimpleMultiContainer = __TYPE_MAP.get_container_cls('SimpleMultiContainer', CORE_NAMESPACE) -AlignedDynamicTable = __TYPE_MAP.get_container_cls('AlignedDynamicTable', CORE_NAMESPACE) +DynamicTable = get_class('DynamicTable', CORE_NAMESPACE) +VectorData = get_class('VectorData', CORE_NAMESPACE) +VectorIndex = get_class('VectorIndex', CORE_NAMESPACE) +ElementIdentifiers = get_class('ElementIdentifiers', CORE_NAMESPACE) +DynamicTableRegion = get_class('DynamicTableRegion', CORE_NAMESPACE) +EnumData = get_class('EnumData', EXP_NAMESPACE) +CSRMatrix = get_class('CSRMatrix', CORE_NAMESPACE) +ExternalResources = get_class('ExternalResources', EXP_NAMESPACE) +SimpleMultiContainer = get_class('SimpleMultiContainer', CORE_NAMESPACE) +AlignedDynamicTable = get_class('AlignedDynamicTable', CORE_NAMESPACE) @docval({'name': 'extensions', 'type': (str, TypeMap, list), @@ -190,18 +202,6 @@ def get_manager(**kwargs): return BuildManager(type_map) -# a function to get the container class for a give type -@docval({'name': 'data_type', 'type': str, - 'doc': 'the data_type to get the Container class for'}, - {'name': 'namespace', 'type': str, 'doc': 'the namespace the data_type is defined in'}, - is_method=False) -def get_class(**kwargs): - """Get the class object of the Container subclass corresponding to a given neurdata_type. - """ - data_type, namespace = getargs('data_type', 'namespace', kwargs) - return __TYPE_MAP.get_container_cls(data_type, namespace) - - @docval({'name': 'io', 'type': HDMFIO, 'doc': 'the HDMFIO object to read from'}, {'name': 'namespace', 'type': str, diff --git a/tests/unit/build_tests/test_classgenerator.py b/tests/unit/build_tests/test_classgenerator.py index 4ba8c6af5..7e99c4142 100644 --- a/tests/unit/build_tests/test_classgenerator.py +++ b/tests/unit/build_tests/test_classgenerator.py @@ -56,7 +56,7 @@ def post_process(cls, classdict, bases, docval_args, spec): namespace_catalog.add_namespace(CORE_NAMESPACE, namespace) type_map = TypeMap(namespace_catalog) type_map.register_generator(MyClassGenerator) - cls = type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) self.assertEqual(cls.process_field_spec, ['attr1']) self.assertTrue(cls.post_process) @@ -108,7 +108,7 @@ def test_dynamic_container_creation(self): attributes=[AttributeSpec('attr3', 'a float attribute', 'float'), AttributeSpec('attr4', 'another float attribute', 'float')]) self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - cls = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) expected_args = {'name', 'data', 'attr1', 'attr2', 'attr3', 'attr4'} received_args = set() for x in get_docval(cls.__init__): @@ -124,7 +124,7 @@ def test_dynamic_container_default_name(self): baz_spec = GroupSpec('doc', default_name='bingo', data_type_def='Baz', attributes=[AttributeSpec('attr4', 'another float attribute', 'float')]) self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - cls = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) inst = cls(attr4=10.) self.assertEqual(inst.name, 'bingo') @@ -134,7 +134,7 @@ def test_dynamic_container_creation_defaults(self): attributes=[AttributeSpec('attr3', 'a float attribute', 'float'), AttributeSpec('attr4', 'another float attribute', 'float')]) self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - cls = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) expected_args = {'name', 'data', 'attr1', 'attr2', 'attr3', 'attr4', 'foo'} received_args = set(map(lambda x: x['name'], get_docval(cls.__init__))) self.assertSetEqual(expected_args, received_args) @@ -147,7 +147,7 @@ def test_dynamic_container_constructor(self): attributes=[AttributeSpec('attr3', 'a float attribute', 'float'), AttributeSpec('attr4', 'another float attribute', 'float')]) self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - cls = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) # TODO: test that constructor works! inst = cls('My Baz', [1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0) self.assertEqual(inst.name, 'My Baz') @@ -165,7 +165,7 @@ def test_dynamic_container_constructor_name(self): attributes=[AttributeSpec('attr3', 'a float attribute', 'float'), AttributeSpec('attr4', 'another float attribute', 'float')]) self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - cls = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) with self.assertRaises(TypeError): inst = cls('My Baz', [1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0) @@ -188,7 +188,7 @@ def test_dynamic_container_constructor_name_default_name(self): attributes=[AttributeSpec('attr3', 'a float attribute', 'float'), AttributeSpec('attr4', 'another float attribute', 'float')]) self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - cls = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + cls = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) inst = cls([1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0) self.assertEqual(inst.name, 'A fixed name') @@ -206,12 +206,12 @@ def test_dynamic_container_composition(self): groups=[GroupSpec('A composition inside', data_type_inc='Baz2')]) self.spec_catalog.register_spec(baz_spec1, 'extension.yaml') self.spec_catalog.register_spec(baz_spec2, 'extension.yaml') - Baz2 = self.type_map.get_container_cls('Baz2', CORE_NAMESPACE) - Baz1 = self.type_map.get_container_cls('Baz1', CORE_NAMESPACE) + Baz2 = self.type_map.get_dt_container_cls('Baz2', CORE_NAMESPACE) + Baz1 = self.type_map.get_dt_container_cls('Baz1', CORE_NAMESPACE) Baz1('My Baz', [1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0, baz2=Baz2('My Baz', [1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0)) - Bar = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) + Bar = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) bar = Bar('My Bar', [1, 2, 3, 4], 'string attribute', 1000) with self.assertRaises(TypeError): @@ -230,12 +230,12 @@ def test_dynamic_container_composition_reverse_order(self): groups=[GroupSpec('A composition inside', data_type_inc='Baz2')]) self.spec_catalog.register_spec(baz_spec1, 'extension.yaml') self.spec_catalog.register_spec(baz_spec2, 'extension.yaml') - Baz1 = self.type_map.get_container_cls('Baz1', CORE_NAMESPACE) - Baz2 = self.type_map.get_container_cls('Baz2', CORE_NAMESPACE) + Baz1 = self.type_map.get_dt_container_cls('Baz1', CORE_NAMESPACE) + Baz2 = self.type_map.get_dt_container_cls('Baz2', CORE_NAMESPACE) Baz1('My Baz', [1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0, baz2=Baz2('My Baz', [1, 2, 3, 4], 'string attribute', 1000, attr3=98.6, attr4=1.0)) - Bar = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) + Bar = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) bar = Bar('My Bar', [1, 2, 3, 4], 'string attribute', 1000) with self.assertRaises(TypeError): @@ -250,14 +250,14 @@ def test_dynamic_container_composition_missing_type(self): msg = "No specification for 'Baz2' in namespace 'test_core'" with self.assertRaisesWith(ValueError, msg): - self.type_map.get_container_cls('Baz1', CORE_NAMESPACE) + self.type_map.get_dt_container_cls('Baz1', CORE_NAMESPACE) def test_dynamic_container_fixed_name(self): """Test that dynamic class generation for an extended type with a fixed name works.""" baz_spec = GroupSpec('A test extension with no Container class', data_type_def='Baz', data_type_inc=self.bar_spec, name='Baz') self.spec_catalog.register_spec(baz_spec, 'extension.yaml') - Baz = self.type_map.get_container_cls('Baz', CORE_NAMESPACE) + Baz = self.type_map.get_dt_container_cls('Baz', CORE_NAMESPACE) obj = Baz([1, 2, 3, 4], 'string attribute', attr2=1000) self.assertEqual(obj.name, 'Baz') @@ -273,8 +273,8 @@ def test_multi_container_spec(self): ] ) self.spec_catalog.register_spec(multi_spec, 'extension.yaml') - Bar = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) - Multi = self.type_map.get_container_cls('Multi', CORE_NAMESPACE) + Bar = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) + Multi = self.type_map.get_dt_container_cls('Multi', CORE_NAMESPACE) assert issubclass(Multi, MultiContainerInterface) assert Multi.__clsconf__ == [ dict( @@ -342,7 +342,7 @@ def test_get_class_separate_ns(self): type_map=self.type_map ) - cls = self.type_map.get_container_cls('Baz', 'ndx-test') + cls = self.type_map.get_dt_container_cls('Baz', 'ndx-test') self.assertEqual(cls.__name__, 'Baz') self.assertTrue(issubclass(cls, Bar)) @@ -365,7 +365,7 @@ def _build_separate_namespaces(self): type_map=self.type_map ) # resolve Spam first so that ndx-qux is resolved first - self.type_map.get_container_cls('Spam', 'ndx-qux') + self.type_map.get_dt_container_cls('Spam', 'ndx-qux') baz_spec = GroupSpec( doc='A test extension', @@ -404,69 +404,69 @@ def _check_classes(self, baz_cls, bar_cls, bar_cls2, qux_cls, qux_cls2): def test_get_class_include_from_separate_ns_1(self): """Test that get_class correctly sets the name and includes types correctly across namespaces. - This is one of multiple tests carried out to ensure that order of which get_container_cls is called + This is one of multiple tests carried out to ensure that order of which get_dt_container_cls is called does not impact the results first use EXTENSION namespace, then use ORIGINAL namespace """ self._build_separate_namespaces() - baz_cls = self.type_map.get_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved - bar_cls = self.type_map.get_container_cls('Bar', 'ndx-test') - bar_cls2 = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) - qux_cls = self.type_map.get_container_cls('Qux', 'ndx-test') - qux_cls2 = self.type_map.get_container_cls('Qux', 'ndx-qux') + baz_cls = self.type_map.get_dt_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved + bar_cls = self.type_map.get_dt_container_cls('Bar', 'ndx-test') + bar_cls2 = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) + qux_cls = self.type_map.get_dt_container_cls('Qux', 'ndx-test') + qux_cls2 = self.type_map.get_dt_container_cls('Qux', 'ndx-qux') self._check_classes(baz_cls, bar_cls, bar_cls2, qux_cls, qux_cls2) def test_get_class_include_from_separate_ns_2(self): """Test that get_class correctly sets the name and includes types correctly across namespaces. - This is one of multiple tests carried out to ensure that order of which get_container_cls is called + This is one of multiple tests carried out to ensure that order of which get_dt_container_cls is called does not impact the results first use ORIGINAL namespace, then use EXTENSION namespace """ self._build_separate_namespaces() - baz_cls = self.type_map.get_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved - bar_cls2 = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) - bar_cls = self.type_map.get_container_cls('Bar', 'ndx-test') - qux_cls = self.type_map.get_container_cls('Qux', 'ndx-test') - qux_cls2 = self.type_map.get_container_cls('Qux', 'ndx-qux') + baz_cls = self.type_map.get_dt_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved + bar_cls2 = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) + bar_cls = self.type_map.get_dt_container_cls('Bar', 'ndx-test') + qux_cls = self.type_map.get_dt_container_cls('Qux', 'ndx-test') + qux_cls2 = self.type_map.get_dt_container_cls('Qux', 'ndx-qux') self._check_classes(baz_cls, bar_cls, bar_cls2, qux_cls, qux_cls2) def test_get_class_include_from_separate_ns_3(self): """Test that get_class correctly sets the name and includes types correctly across namespaces. - This is one of multiple tests carried out to ensure that order of which get_container_cls is called + This is one of multiple tests carried out to ensure that order of which get_dt_container_cls is called does not impact the results first use EXTENSION namespace, then use EXTENSION namespace """ self._build_separate_namespaces() - baz_cls = self.type_map.get_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved - bar_cls = self.type_map.get_container_cls('Bar', 'ndx-test') - bar_cls2 = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) - qux_cls2 = self.type_map.get_container_cls('Qux', 'ndx-qux') - qux_cls = self.type_map.get_container_cls('Qux', 'ndx-test') + baz_cls = self.type_map.get_dt_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved + bar_cls = self.type_map.get_dt_container_cls('Bar', 'ndx-test') + bar_cls2 = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) + qux_cls2 = self.type_map.get_dt_container_cls('Qux', 'ndx-qux') + qux_cls = self.type_map.get_dt_container_cls('Qux', 'ndx-test') self._check_classes(baz_cls, bar_cls, bar_cls2, qux_cls, qux_cls2) def test_get_class_include_from_separate_ns_4(self): """Test that get_class correctly sets the name and includes types correctly across namespaces. - This is one of multiple tests carried out to ensure that order of which get_container_cls is called + This is one of multiple tests carried out to ensure that order of which get_dt_container_cls is called does not impact the results first use ORIGINAL namespace, then use EXTENSION namespace """ self._build_separate_namespaces() - baz_cls = self.type_map.get_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved - bar_cls2 = self.type_map.get_container_cls('Bar', CORE_NAMESPACE) - bar_cls = self.type_map.get_container_cls('Bar', 'ndx-test') - qux_cls2 = self.type_map.get_container_cls('Qux', 'ndx-qux') - qux_cls = self.type_map.get_container_cls('Qux', 'ndx-test') + baz_cls = self.type_map.get_dt_container_cls('Baz', 'ndx-test') # Qux and Bar are not yet resolved + bar_cls2 = self.type_map.get_dt_container_cls('Bar', CORE_NAMESPACE) + bar_cls = self.type_map.get_dt_container_cls('Bar', 'ndx-test') + qux_cls2 = self.type_map.get_dt_container_cls('Qux', 'ndx-qux') + qux_cls = self.type_map.get_dt_container_cls('Qux', 'ndx-test') self._check_classes(baz_cls, bar_cls, bar_cls2, qux_cls, qux_cls2) diff --git a/tests/unit/common/test_common.py b/tests/unit/common/test_common.py index 053e8d175..76c99d44a 100644 --- a/tests/unit/common/test_common.py +++ b/tests/unit/common/test_common.py @@ -7,7 +7,7 @@ class TestCommonTypeMap(TestCase): def test_base_types(self): tm = get_type_map() - cls = tm.get_container_cls('Container', 'hdmf-common') + cls = tm.get_dt_container_cls('Container', 'hdmf-common') self.assertIs(cls, Container) - cls = tm.get_container_cls('Data', 'hdmf-common') + cls = tm.get_dt_container_cls('Data', 'hdmf-common') self.assertIs(cls, Data) diff --git a/tests/unit/common/test_generate_table.py b/tests/unit/common/test_generate_table.py index e2fec9bbe..6a7bc24b1 100644 --- a/tests/unit/common/test_generate_table.py +++ b/tests/unit/common/test_generate_table.py @@ -133,8 +133,8 @@ def setUp(self): self.type_map.load_namespaces(namespace_fpath) self.manager = BuildManager(self.type_map) - self.TestTable = self.type_map.get_container_cls('TestTable', CORE_NAMESPACE) - self.TestDTRTable = self.type_map.get_container_cls('TestDTRTable', CORE_NAMESPACE) + self.TestTable = self.type_map.get_dt_container_cls('TestTable', CORE_NAMESPACE) + self.TestDTRTable = self.type_map.get_dt_container_cls('TestDTRTable', CORE_NAMESPACE) def tearDown(self) -> None: shutil.rmtree(self.test_dir)