diff --git a/pylint/pyreverse/diagrams.py b/pylint/pyreverse/diagrams.py
index 056dd8744b..543467e9d5 100644
--- a/pylint/pyreverse/diagrams.py
+++ b/pylint/pyreverse/diagrams.py
@@ -168,7 +168,8 @@ def class_names(self, nodes_lst: Iterable[nodes.NodeNG]) -> list[str]:
if node.name not in names:
node_name = node.name
names.append(node_name)
- return names
+ # sorted to get predictable (hence testable) results
+ return sorted(names)
def has_node(self, node: nodes.NodeNG) -> bool:
"""Return true if the given node is included in the diagram."""
diff --git a/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.dot b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.dot
new file mode 100644
index 0000000000..f5c42258f3
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.dot
@@ -0,0 +1,5 @@
+digraph "classes" {
+rankdir=BT
+charset="utf-8"
+"line_breaks.A" [color="black", fontcolor="black", label=<{A|
|f(x: str | None)
}>, shape="record", style="solid"];
+}
diff --git a/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.mmd b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.mmd
new file mode 100644
index 0000000000..0abb8eeb76
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.mmd
@@ -0,0 +1,4 @@
+classDiagram
+ class A {
+ f(x: str | None)*
+ }
diff --git a/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.puml b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.puml
new file mode 100644
index 0000000000..1515ea001e
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.puml
@@ -0,0 +1,6 @@
+@startuml classes
+set namespaceSeparator none
+class "A" as line_breaks.A {
+ {abstract}f(x: str | None)
+}
+@enduml
diff --git a/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.py b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.py
new file mode 100644
index 0000000000..2c084cebd2
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.py
@@ -0,0 +1,5 @@
+# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8671
+
+class A:
+ def f(self, x: str | None):
+ pass
diff --git a/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.rc b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.rc
new file mode 100644
index 0000000000..9e2ff3d953
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/annotations/line_breaks.rc
@@ -0,0 +1,2 @@
+[testoptions]
+output_formats=mmd,dot,puml
diff --git a/tests/pyreverse/functional/class_diagrams/attributes/duplicates.mmd b/tests/pyreverse/functional/class_diagrams/attributes/duplicates.mmd
new file mode 100644
index 0000000000..ee13b83462
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/attributes/duplicates.mmd
@@ -0,0 +1,20 @@
+classDiagram
+ class A {
+ }
+ class DuplicateAnnotations {
+ lav : list, list[str]
+ val : str, str | int
+ bar() None
+ }
+ class DuplicateArrows {
+ a
+ a
+ }
+ class DuplicateFields {
+ example1 : int
+ example1 : int
+ example2 : int
+ example2 : int
+ }
+ A --* DuplicateArrows : a
+ A --* DuplicateArrows : a
diff --git a/tests/pyreverse/functional/class_diagrams/attributes/duplicates.py b/tests/pyreverse/functional/class_diagrams/attributes/duplicates.py
new file mode 100644
index 0000000000..a3f05b81cb
--- /dev/null
+++ b/tests/pyreverse/functional/class_diagrams/attributes/duplicates.py
@@ -0,0 +1,31 @@
+# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8189
+class DuplicateFields():
+ example1: int
+ example2: int
+
+ def __init__(self):
+ self.example1 = 1
+ self.example2 = 2
+
+
+# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8522
+class A:
+ pass
+
+class DuplicateArrows:
+ a: A
+
+ def __init__(self):
+ self.a = A()
+
+
+
+# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8888
+class DuplicateAnnotations:
+ def __init__(self) -> None:
+ self.val: str | int = "1"
+ self.lav: list[str] = []
+
+ def bar(self) -> None:
+ self.val = "2"
+ self.lav = []