Replace assert statements by normal if/raise
This commit is contained in:
parent
98969b75c7
commit
d47bf34522
@ -78,8 +78,10 @@ class ListModel(QAbstractListModel):
|
||||
def _convert_new_value(self, value: NewItem) -> ListItem:
|
||||
def convert() -> ListItem:
|
||||
if self._data and isinstance(value, Mapping):
|
||||
assert set(value.keys()) <= set(self.roles), \
|
||||
f"{value}: must have all these keys: {self.roles}"
|
||||
if not set(value.keys()) <= set(self.roles):
|
||||
raise ValueError(
|
||||
f"{value}: must have all these keys: {self.roles}"
|
||||
)
|
||||
|
||||
return type(self._data[0])(**value)
|
||||
|
||||
|
@ -124,7 +124,8 @@ class SignalManager(QObject):
|
||||
inviter: Inviter = None,
|
||||
left_event: LeftEvent = None) -> None:
|
||||
|
||||
assert not (inviter and left_event)
|
||||
if (inviter and left_event):
|
||||
raise ValueError()
|
||||
|
||||
model = self.backend.models.rooms[client.userId]
|
||||
no_update = []
|
||||
|
Loading…
Reference in New Issue
Block a user