Skip to content

Commit 9e4b69c

Browse files
yt-msMidnighter
authored andcommitted
style: resolve some flake8 items
1 parent 49de1bf commit 9e4b69c

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

tests/integration/test_model_element_relationships.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828

2929

3030
def test_adding_relationship_to_element_adds_to_model():
31-
"""
31+
"""Ensure relationships are added to the model.
32+
3233
Make sure that when a relationship is added via Element.add_relationship it also
3334
gets added to the model and to the other element.
3435
"""
@@ -47,9 +48,10 @@ def test_adding_relationship_to_element_adds_to_model():
4748

4849

4950
def test_adding_relationship_to_model_adds_to_element():
50-
"""
51-
Make sure that when a relationship is added via Element.add_relationship it also
52-
gets added to the model and to the other element.
51+
"""Ensure relationships are added to elements.
52+
53+
Make sure that when a relationship is added via Model.add_relationship it also
54+
gets added to the elements.
5355
"""
5456
model = Model()
5557
sys1 = model.add_software_system(name="sys1")
@@ -66,10 +68,7 @@ def test_adding_relationship_to_model_adds_to_element():
6668

6769

6870
def test_adding_relationship_via_uses_adds_to_elements():
69-
"""
70-
Make sure that when a relationship is added via StaticStructureElement.uses
71-
then it is reflected in the Elements.
72-
"""
71+
"""Ensure uses() adds relationships to the model and elements."""
7372
model = Model()
7473
sys1 = model.add_software_system(name="sys1")
7574
sys2 = model.add_software_system(name="sys2")
@@ -87,7 +86,7 @@ def test_adding_relationship_via_uses_adds_to_elements():
8786
["BigBank.json"],
8887
)
8988
def test_relationships_after_deserialisation_are_consistent(filename: str):
90-
"""Make sure that relationships are consistent between the Model and the Element after deserialisation."""
89+
"""Ensure deserialisaton leaves realationships consistent."""
9190
path = DEFINITIONS / filename
9291
workspace = Workspace.load(path)
9392
model = workspace.model

tests/integration/test_model_elements.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
@pytest.fixture(scope="function")
2626
def model() -> Model:
27+
"""Manufacture an empty model for test cases."""
2728
return Model()
2829

2930

tests/unit/model/test_element.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class MockModel:
3131
"""Implement a mock model for reference testing."""
3232

3333
def add_relationship(self, relationship):
34+
"""Provide mock implementation."""
3435
return relationship
3536

3637

tests/unit/model/test_model.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_model_get_relationship_by_id(empty_model: Model):
3434

3535

3636
def test_model_add_relationship_twice_ignored(empty_model: Model):
37-
"""Make sure that adding an existing relationship to the Model makes no difference."""
37+
"""Ensure that adding an existing relationship to the Model makes no difference."""
3838
sys1 = empty_model.add_software_system(name="sys1")
3939
sys2 = empty_model.add_software_system(name="sys2")
4040
relationship = empty_model.add_relationship(source=sys1, destination=sys2)
@@ -47,13 +47,11 @@ def test_model_cannot_add_relationship_with_same_id_as_existing(empty_model: Mod
4747
"""Ensure you can't add two relationships with the same ID."""
4848
sys1 = empty_model.add_software_system(name="sys1")
4949
sys2 = empty_model.add_software_system(name="sys2")
50-
relationship1 = empty_model.add_relationship(source=sys1, destination=sys2, id="r1")
50+
empty_model.add_relationship(source=sys1, destination=sys2, id="r1")
5151
with pytest.raises(
5252
ValueError, match="Relationship.* has the same ID as Relationship.*"
5353
):
54-
relationship2 = empty_model.add_relationship(
55-
source=sys1, destination=sys2, id="r1"
56-
)
54+
empty_model.add_relationship(source=sys1, destination=sys2, id="r1")
5755

5856

5957
def test_model_cannot_add_relationship_with_same_id_as_element(empty_model: Model):

tests/unit/model/test_model_item.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def test_default_and_custom_tags(empty_model: Model):
6969

7070

7171
def test_tag_order_is_preserved_to_and_from_io(empty_model: Model):
72-
"""Test that when serializing via IO classes or back that tag ordering is preserved."""
72+
"""Test that when serializing via IO classes or back, tag ordering is preserved."""
7373
element = empty_model.add_software_system(name="Name", description="Description")
7474
element.tags.update(["tag3", "tag2", "tag1"]) # Deliberately not ascending
7575

tests/unit/model/test_software_system.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_software_system_init(attributes):
3737

3838

3939
def test_add_container_accepts_additional_args():
40-
"""Test other keyword arguments (e.g. id) are allowed when adding a new container."""
40+
"""Test keyword arguments (e.g. id) are allowed when adding a new container."""
4141
model = Model()
4242
system = model.add_software_system(name="Banking System")
4343
container = system.add_container("container", "description", id="id1")

0 commit comments

Comments
 (0)