Skip to content

MappingSet.empty() initializes 'mappings' as a dict instead of a list #477

@hrshdhgd

Description

@hrshdhgd

Describe the bug

When an empty MappingSet object is initialized for e.g.: test = MappingSet(mapping_set_id = "x", license = "v") the resultant test object looks like this:

MappingSet
  (
    mapping_set_id='x', 
    license='v', 
    mappings={}, # ***Should be empty list ****
    mapping_set_version=None, mapping_set_source=[], mapping_set_description=None, 
    creator_id=[], creator_label=[], subject_source=None, subject_source_version=None, 
    object_source=None, object_source_version=None, mapping_provider=None, 
    mapping_tool=None, mapping_date=None, subject_match_field=[], 
    object_match_field=[], subject_preprocessing=[], object_preprocessing=[], 
    match_term_type=None, see_also=[], other=None, comment=None
)

The 'mappings' initialization in the MappingSet class is as follows:

mappings: Optional[
        Union[Union[dict, "Mapping"], List[Union[dict, "Mapping"]]]
    ] = empty_list()

So an empty list is expected but in the example above , we see that the mappings object is an empty dictionary.

To Reproduce

Mentioned above.

Expected behavior
mappings = Empty List

Metadata

Metadata

Assignees

Labels

bugSomething that should work but isn't, with an example and a test case.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions