0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

test: add tests for config dialog

This commit is contained in:
2025-06-06 14:18:36 +02:00
committed by David Perl
parent 886964bb54
commit a9613a07b0
6 changed files with 148 additions and 38 deletions

View File

@ -430,7 +430,7 @@ class ListMetadataField(DynamicFormItem):
return self._data
def setValue(self, value: list):
if set(map(type, value)) != {self._types.item}:
if set(map(type, value)) | {self._types.item} != {self._types.item}:
raise ValueError(f"This widget only accepts items of type {self._types.item}")
self._repop(value)

View File

@ -193,8 +193,8 @@ class DictBackedTable(QWidget):
def clear(self):
self._table_model.replaceData({})
def replace_data(self, data: dict):
self._table_model.replaceData(data)
def replace_data(self, data: dict | None):
self._table_model.replaceData(data or {})
def delete_selected_rows(self):
"""Delete rows which are part of the selection model"""

View File

@ -28,9 +28,13 @@ class DeviceConfigDialog(BECWidget, QDialog):
RPC = False
def __init__(
self, parent=None, device: str | None = None, config_helper: ConfigHelper | None = None
self,
parent=None,
device: str | None = None,
config_helper: ConfigHelper | None = None,
**kwargs,
):
super().__init__(parent=parent)
super().__init__(parent=parent, **kwargs)
self._config_helper = config_helper or ConfigHelper(
self.client.connector, self.client._service_name
)