Adopt C4 terminology: Rename Dependency -> Relationship

pull/508/head
Marc Bruggmann 4 years ago
parent 7d546031b8
commit c2e2f45372

@ -121,7 +121,7 @@ def SystemBoundary(name, **kwargs):
return Cluster(name, graph_attr=graph_attributes) return Cluster(name, graph_attr=graph_attributes)
def Dependency(label="", **kwargs): def Relationship(label="", **kwargs):
edge_attribtues = {"style": "dashed", "color": "gray60"} edge_attribtues = {"style": "dashed", "color": "gray60"}
if label: if label:
edge_attribtues.update({"label": _format_edge_label(label)}) edge_attribtues.update({"label": _format_edge_label(label)})

@ -5,7 +5,7 @@ import unittest
from diagrams import Diagram from diagrams import Diagram
from diagrams import setcluster, setdiagram from diagrams import setcluster, setdiagram
from diagrams.c4 import Person, Container, Database, System, SystemBoundary, Dependency from diagrams.c4 import Person, Container, Database, System, SystemBoundary, Relationship
class C4Test(unittest.TestCase): class C4Test(unittest.TestCase):
@ -26,8 +26,6 @@ class C4Test(unittest.TestCase):
container = Container("container", "Java application", "The application.") container = Container("container", "Java application", "The application.")
database = Database("database", "Oracle database", "Stores information.") database = Database("database", "Oracle database", "Stores information.")
person >> container >> database
def test_external_nodes(self): def test_external_nodes(self):
with Diagram(name=self.name, show=False): with Diagram(name=self.name, show=False):
external_person = Person("person", external=True) external_person = Person("person", external=True)
@ -38,22 +36,27 @@ class C4Test(unittest.TestCase):
system = System("system", "The internal system.") system = System("system", "The internal system.")
system_without_description = System("unknown") system_without_description = System("unknown")
system >> system_without_description >> external_system
def test_edges(self): def test_edges(self):
with Diagram(name=self.name, show=False): with Diagram(name=self.name, show=False):
c1 = Container("container1", "type", "description") c1 = Container("container1")
c2 = Container("container2", "type", "description") c2 = Container("container2")
c1 >> c2
def test_edges_with_labels(self):
with Diagram(name=self.name, show=False):
c1 = Container("container1")
c2 = Container("container2")
c1 >> Dependency("depends on") >> c2 c1 >> Relationship("depends on") >> c2
c1 << Dependency("is dependend on") << c2 c1 << Relationship("is depended on by") << c2
def test_edge_without_constraint(self): def test_edge_without_constraint(self):
with Diagram(name=self.name, show=False): with Diagram(name=self.name, show=False):
s1 = System("system 1") s1 = System("system 1")
s2 = System("system 2") s2 = System("system 2")
s1 >> Dependency(constraint="False") >> s2 s1 >> Relationship(constraint="False") >> s2
def test_cluster(self): def test_cluster(self):
with Diagram(name=self.name, show=False): with Diagram(name=self.name, show=False):

Loading…
Cancel
Save