Skip to content

Commit 7e02750

Browse files
yt-msMidnighter
authored andcommitted
test: replicate API change for Model to mocks.
1 parent 61a565c commit 7e02750

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/structurizr/model/software_system.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,12 @@ def __iadd__(self, container: Container) -> "SoftwareSystem":
100100
container.parent = self
101101
elif container.parent is not self:
102102
raise ValueError(
103-
f"Container with name {container.name} already has parent {container.parent}. Cannot add to {self}."
103+
f"Container with name {container.name} already has parent "
104+
f"{container.parent}. Cannot add to {self}."
104105
)
105106
self.containers.add(container)
106-
self.get_model().add_container(container)
107+
model = self.get_model()
108+
model += container
107109
return self
108110

109111
def get_container_with_name(self, name: str) -> Container:

tests/unit/model/test_software_system.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def __init__(self):
3030
self.empty_system = SoftwareSystem(name="Sys")
3131
self.empty_system.set_model(self)
3232

33-
def add_container(self, container):
33+
def __iadd__(self, container):
3434
"""Simulate the model assigning IDs to new elements."""
3535
if not container.id:
3636
container.id = "id"
3737
container.set_model(self)
38-
pass
38+
return self
3939

4040

4141
@pytest.fixture(scope="function")

0 commit comments

Comments
 (0)