diff options
author | Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com> | 2021-07-30 20:21:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-30 20:21:02 +0200 |
commit | b71be8a07ecc7d8aafbc07733e458b338eef6155 (patch) | |
tree | 09e28675289c2af7023743569ce57f237358f093 /tests/data | |
parent | 5e5f48d05fb6f1322a7420d6ea7586966b08f80a (diff) | |
download | pylint-git-b71be8a07ecc7d8aafbc07733e458b338eef6155.tar.gz |
Handle has-a relationships for type-hinted arguments in class diagrams (#4745)
* Pyreverse - Show class has-a relationships inferred from type-hints
Closes #4744
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'tests/data')
-rw-r--r-- | tests/data/classes_No_Name.dot | 12 | ||||
-rw-r--r-- | tests/data/clientmodule_test.py | 5 | ||||
-rw-r--r-- | tests/data/suppliermodule_test.py | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/tests/data/classes_No_Name.dot b/tests/data/classes_No_Name.dot index 8867b4e41..c5eb70f0c 100644 --- a/tests/data/classes_No_Name.dot +++ b/tests/data/classes_No_Name.dot @@ -3,10 +3,12 @@ charset="utf-8" rankdir=BT "0" [label="{Ancestor|attr : str\lcls_member\l|get_value()\lset_value(value)\l}", shape="record"]; "1" [label="{DoNothing|\l|}", shape="record"]; -"2" [label="{Interface|\l|get_value()\lset_value(value)\l}", shape="record"]; -"3" [label="{Specialization|TYPE : str\lrelation\ltop : str\l|}", shape="record"]; -"3" -> "0" [arrowhead="empty", arrowtail="none"]; -"0" -> "2" [arrowhead="empty", arrowtail="node", style="dashed"]; +"2" [label="{DoNothing2|\l|}", shape="record"]; +"3" [label="{Interface|\l|get_value()\lset_value(value)\l}", shape="record"]; +"4" [label="{Specialization|TYPE : str\lrelation\lrelation2\ltop : str\l|}", shape="record"]; +"4" -> "0" [arrowhead="empty", arrowtail="none"]; +"0" -> "3" [arrowhead="empty", arrowtail="node", style="dashed"]; "1" -> "0" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="cls_member", style="solid"]; -"1" -> "3" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"]; +"1" -> "4" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation", style="solid"]; +"2" -> "4" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="relation2", style="solid"]; } diff --git a/tests/data/clientmodule_test.py b/tests/data/clientmodule_test.py index 40db2e77e..82deaaf6f 100644 --- a/tests/data/clientmodule_test.py +++ b/tests/data/clientmodule_test.py @@ -1,5 +1,5 @@ """ docstring for file clientmodule.py """ -from data.suppliermodule_test import Interface, DoNothing +from data.suppliermodule_test import Interface, DoNothing, DoNothing2 class Ancestor: """ Ancestor method """ @@ -23,7 +23,8 @@ class Specialization(Ancestor): TYPE = 'final class' top = 'class' - def __init__(self, value, _id): + def __init__(self, value, _id, relation2: DoNothing2): Ancestor.__init__(self, value) self._id = _id self.relation = DoNothing() + self.relation2 = relation2 diff --git a/tests/data/suppliermodule_test.py b/tests/data/suppliermodule_test.py index 24dc9a02f..6af30fa08 100644 --- a/tests/data/suppliermodule_test.py +++ b/tests/data/suppliermodule_test.py @@ -8,3 +8,5 @@ class Interface: raise NotImplementedError class DoNothing: pass + +class DoNothing2: pass |