Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spinedb_api/mapped_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def __init__(self, db_map, **kwargs):
super().__init__(db_map, **kwargs)
if "parameter_type_list" in kwargs:
self._init_type_list = kwargs["parameter_type_list"]
if len(set(self._init_type_list)) != len(self._init_type_list):
if self._init_type_list is not None and len(set(self._init_type_list)) != len(self._init_type_list):
raise SpineDBAPIError("entries in parameter_type_list must be unique")
else:
self._init_type_list = None
Expand Down
17 changes: 17 additions & 0 deletions tests/test_parameter_definitions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
######################################################################################################################
# Copyright (C) 2017-2022 Spine project consortium
# Copyright Spine Database API contributors
# This file is part of Spine Database API.
# Spine Database API is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details. You should have received a copy of the GNU Lesser General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################
def test_add_or_update_when_setting_parameter_type_list_to_none(db_map):
db_map.add_entity_class(name="Gadget")
definition = db_map.add_or_update_parameter_definition(
entity_class_name="Gadget", name="X", parameter_type_list=None
)
assert definition["parameter_type_list"] == ()
Loading