You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.
If add_nearest_neighbours() is called more than once for the same element (e.g. with different neighbour types) then it can currently duplicate relationships.
fromstructurizr.modelimportModel, Person, SoftwareSystemfromstructurizr.view.static_viewimportStaticViewclassDerivedView(StaticView):
"""Mock class for testing."""defadd_all_elements(self) ->None:
"""Stub method because base is abstract."""passdeftest_add_nearest_neighbours_doesnt_dupe_relationships():
"""Test relationships aren't duplicated if neighbours added more than once."""model=Model()
sys1=model.add_software_system(name="System 1")
sys2=model.add_software_system(name="System 2")
sys1.uses(sys2)
view=DerivedView(software_system=sys1, description="")
view.add_nearest_neighbours(sys1, SoftwareSystem)
assertlen(view.relationship_views) ==1# The next line will currently dupe the relationshipview.add_nearest_neighbours(sys1, Person)
assertlen(view.relationship_views) ==1# This fails as it's 2
Context
System Information
==================
OS Windows
OS-release 10
Python 3.7.5
Package Versions
================
depinfo 1.5.4
httpx 0.16.1
importlib_metadata 1.7.0
ordered-set 3.1
pip 20.2.4
pydantic 1.7.1
python-dotenv 0.14.0
setuptools 41.2.0
structurizr-python 0.2.1+29.gf1b13ef.dirty
The text was updated successfully, but these errors were encountered:
Problem description
If
add_nearest_neighbours()
is called more than once for the same element (e.g. with different neighbour types) then it can currently duplicate relationships.Code Sample
Create a minimal, complete, verifiable example.
Context
The text was updated successfully, but these errors were encountered: