diff options
author | DudeNr33 <3929834+DudeNr33@users.noreply.github.com> | 2022-05-27 19:00:16 +0200 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2022-05-27 20:39:02 +0200 |
commit | 854170d866c60e2852f38be54d1d8d32eb53e808 (patch) | |
tree | 62a635568eea472dd13e2dfd7c13ca6381668529 /tests/pyreverse | |
parent | 4fb07dfe2c93ed9dd36bae223f75d632a7b498e2 (diff) | |
download | pylint-git-854170d866c60e2852f38be54d1d8d32eb53e808.tar.gz |
Fix return type annotations in MermaidJS diagrams.
Diffstat (limited to 'tests/pyreverse')
4 files changed, 29 insertions, 6 deletions
diff --git a/tests/pyreverse/data/classes_No_Name.html b/tests/pyreverse/data/classes_No_Name.html index b4ada04b8..956758223 100644 --- a/tests/pyreverse/data/classes_No_Name.html +++ b/tests/pyreverse/data/classes_No_Name.html @@ -20,7 +20,7 @@ my_int : Optional[int] my_int_2 : Optional[int] my_string : str - do_it(new_int: int) -> int + do_it(new_int: int) int } class Interface { get_value() @@ -36,8 +36,8 @@ relation2 top : str from_value(value: int) - increment_value() -> None - transform_value(value: int) -> int + increment_value() None + transform_value(value: int) int } Specialization --|> Ancestor Ancestor ..|> Interface diff --git a/tests/pyreverse/data/classes_No_Name.mmd b/tests/pyreverse/data/classes_No_Name.mmd index efdaacae1..4daa91c24 100644 --- a/tests/pyreverse/data/classes_No_Name.mmd +++ b/tests/pyreverse/data/classes_No_Name.mmd @@ -15,7 +15,7 @@ classDiagram my_int : Optional[int] my_int_2 : Optional[int] my_string : str - do_it(new_int: int) -> int + do_it(new_int: int) int } class Interface { get_value() @@ -31,8 +31,8 @@ classDiagram relation2 top : str from_value(value: int) - increment_value() -> None - transform_value(value: int) -> int + increment_value() None + transform_value(value: int) int } Specialization --|> Ancestor Ancestor ..|> Interface diff --git a/tests/pyreverse/functional/class_diagrams/annotations/method_annotation.mmd b/tests/pyreverse/functional/class_diagrams/annotations/method_annotation.mmd new file mode 100644 index 000000000..705228c3a --- /dev/null +++ b/tests/pyreverse/functional/class_diagrams/annotations/method_annotation.mmd @@ -0,0 +1,6 @@ +classDiagram + class Monkey { + eat(food: Banana | Coconut) None + jump(height: Optional[int]) None + scream(volume: int | None) Sound + } diff --git a/tests/pyreverse/functional/class_diagrams/annotations/method_annotation.py b/tests/pyreverse/functional/class_diagrams/annotations/method_annotation.py new file mode 100644 index 000000000..08405ed0a --- /dev/null +++ b/tests/pyreverse/functional/class_diagrams/annotations/method_annotation.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +# pylint: disable-next=import-error +from lib import Banana, Coconut, Sound # type: ignore[import] + + +class Monkey: + def eat(self, food: Banana | Coconut) -> None: + print(f"Monkey eats {food}") + + def jump(self, height: int | None = 10) -> None: + print(f"Monkey jumps {height}") + + def scream(self, volume: int | None) -> Sound: + if volume is None: + volume = 0 + return Sound(volume) |