Skip to content

raise Error for orphaned containers #655

Open
@ajtritt

Description

@ajtritt

Problem/Use Case

Currently, orphaned containers i.e. containers with no parent result in a raised warning. This should raise an Error instead.

The relevant code is in pynwb.form.build.map.ObjectMapper.__add_containers:

def __add_containers(self, builder, spec, value, build_manager, source, parent_container):
if isinstance(value, Container):
if value.parent is None:
msg = "'%s' (%s) for '%s' (%s)"\
% (value.name, getattr(value, self.spec.type_key()),
builder.name, self.spec.data_type_def)
warnings.warn(msg, OrphanContainerWarning)

This will likely break some tests and will require refactoring some parts of the test suite.

Checklist

  • Have you ensured the feature or change was not already reported ?
  • Have you included a brief and descriptive title?
  • Have you included a clear description of the problem you are trying to solve?
  • Have you included a minimal code snippet that reproduces the issue you are encountering?

Metadata

Metadata

Assignees

Labels

help wanted: deep diverequest for community contributions that will involve many parts of the code base

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions