forked from pylint-dev/pylint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Pyreverse line break bug (pylint-dev#8988)
* Elaborate line break test * Fix Pyreverse line break bug
- Loading branch information
Showing
6 changed files
with
16 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Fix a line break error in Pyreverse dot output. | ||
|
||
Closes #8671 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/pyreverse/functional/class_diagrams/annotations/line_breaks.dot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
digraph "classes" { | ||
rankdir=BT | ||
charset="utf-8" | ||
"line_breaks.A" [color="black", fontcolor="black", label=<{A|<br ALIGN="LEFT"/>|<I>f</I>(x: str | None)<br ALIGN="LEFT"/>}>, shape="record", style="solid"]; | ||
"line_breaks.A" [color="black", fontcolor="black", label=<{A|p : int \| None<br ALIGN="LEFT"/>|<I>f</I>(x: str \| None \| (list[A] \| list[int]), y: A \| (int \| str) \| None): int \| str \| list[A \| int]<br ALIGN="LEFT"/>}>, shape="record", style="solid"]; | ||
} |
3 changes: 2 additions & 1 deletion
3
tests/pyreverse/functional/class_diagrams/annotations/line_breaks.mmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
classDiagram | ||
class A { | ||
f(x: str | None)* | ||
p : int | None | ||
f(x: str | None | (list[A] | list[int]), y: A | (int | str) | None)* int | str | list[A | int] | ||
} |
3 changes: 2 additions & 1 deletion
3
tests/pyreverse/functional/class_diagrams/annotations/line_breaks.puml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
@startuml classes | ||
set namespaceSeparator none | ||
class "A" as line_breaks.A { | ||
{abstract}f(x: str | None) | ||
p : int | None | ||
{abstract}f(x: str | None | (list[A] | list[int]), y: A | (int | str) | None) -> int | str | list[A | int] | ||
} | ||
@enduml |
7 changes: 6 additions & 1 deletion
7
tests/pyreverse/functional/class_diagrams/annotations/line_breaks.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
# OPEN BUG: https://github.com/pylint-dev/pylint/issues/8671 | ||
|
||
class A: | ||
def f(self, x: str | None): | ||
p: int | None | ||
|
||
def f(self, | ||
x: (str | None) | (list[A] | list[int]), | ||
y: A | (int | str) | None, | ||
) -> int | str | list[A | int]: | ||
pass |