Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

Commit c57d2ce

Browse files
yt-msMidnighter
authored andcommitted
refactor: rename is_in_model to has_model
1 parent 7203604 commit c57d2ce

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/structurizr/mixin/model_ref_mixin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def model(self) -> "Model":
4141
return self.get_model()
4242

4343
@property
44-
def is_in_model(self) -> bool:
44+
def has_model(self) -> bool:
4545
"""Return whether a model has been set."""
4646
return self._model() is not None
4747

src/structurizr/model/container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def __iadd__(self, component: Component) -> "Container":
156156
f"{component.parent}. Cannot add to {self}."
157157
)
158158
self._components.add(component)
159-
if self.is_in_model:
159+
if self.has_model:
160160
model = self.model
161161
model += component
162162
return self

src/structurizr/model/deployment_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def _add_child_deployment_node(self, node: "DeploymentNode"):
280280
f"{node.parent}. Cannot add to {self}."
281281
)
282282
self._children.add(node)
283-
if self.is_in_model:
283+
if self.has_model:
284284
model = self.model
285285
model += node
286286

src/structurizr/model/software_system.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __iadd__(self, container: Container) -> "SoftwareSystem":
110110
f"{container.parent}. Cannot add to {self}."
111111
)
112112
self._containers.add(container)
113-
if self.is_in_model:
113+
if self.has_model:
114114
model = self.model
115115
model += container
116116
return self

tests/unit/model/test_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,6 @@ def test_model_automatically_adds_child_elements(empty_model: Model):
179179
system = SoftwareSystem(name="System")
180180
container = system.add_container(name="Container")
181181

182-
assert not container.is_in_model
182+
assert not container.has_model
183183
empty_model += system
184-
assert container.is_in_model
184+
assert container.has_model

0 commit comments

Comments
 (0)