Skip to content

Commit

Permalink
refactor: Apply changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ewuerger committed Mar 3, 2023
1 parent 44053f2 commit fd84c08
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion capella_rm_bridge/changeset/actiontypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class InvalidTrackerConfig(Exception):
class WorkItem(te.TypedDict, total=False):
"""A workitem from the snapshot."""

id: te.Required[int]
id: te.Required[str | int]
long_name: str
text: str
type: str
Expand Down
1 change: 1 addition & 0 deletions capella_rm_bridge/changeset/change.py
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ def attribute_value_mod_action(
self.model, f"{id} {req_type_id}", deftype, below=self.reqt_folder
)
attr = req.attributes.by_definition(attrdef, single=True)
assert attrdef is not None
if isinstance(attr, reqif.EnumerationValueAttribute):
assert isinstance(valueid, list)
actual = set(attr.values.by_identifier)
Expand Down
2 changes: 1 addition & 1 deletion capella_rm_bridge/changeset/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def find_by(

def find_by_identifier(
model: capellambse.MelodyModel, id: str, *xtypes: str, **kw
) -> reqif.ReqIFElement:
) -> reqif.ReqIFElement | None:
"""Try to return a model object by its ``identifier``."""
return find_by(model, id, *xtypes, **kw)
5 changes: 3 additions & 2 deletions docs/source/snapshot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,9 @@ are supported:
calculation.

With the ``children`` key the hierarchical structure of the workitems is
exported and empty children will result in a ``Requirement``. Conversely
non-empty children will cause change action on a ``Folder``.
exported. The existance of a ``children`` key will result in a ``Folder``.
Conversely if there is no ``children`` key will cause change action on a
``Requirement``.

Complete snapshot
=================
Expand Down
4 changes: 2 additions & 2 deletions tests/test_changeset.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ def test_faulty_simple_attributes_log_AttributeError(
titem = tracker["items"][0]
titem["imagination"] = 1
message_end = (
"Invalid module 'project/space/example title'. Invalid "
"workitem 'REQ-001'. imagination isn't defined on Folder"
"Invalid module 'project/space/example title'. Invalid workitem "
"'REQ-001'. 'Folder' object has no attribute 'imagination'"
)

with caplog.at_level(logging.ERROR):
Expand Down

0 comments on commit fd84c08

Please sign in to comment.