-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
57 additions
and
41 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
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
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
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,17 +1,8 @@ | ||
from paracelsus.graph import get_graph_string | ||
|
||
from .utils import mermaid_assert | ||
|
||
|
||
def test_get_graph_string(package_path): | ||
graph_string = get_graph_string("example.base:Base", ["example.models"], [package_path], "mermaid") | ||
|
||
assert "users {" in graph_string | ||
assert "posts {" in graph_string | ||
assert "comments {" in graph_string | ||
|
||
assert "users ||--o{ posts : author" in graph_string | ||
assert "posts ||--o{ comments : post" in graph_string | ||
assert "users ||--o{ comments : author" in graph_string | ||
|
||
assert "CHAR(32) author FK" in graph_string | ||
assert 'CHAR(32) post FK "nullable"' in graph_string | ||
assert "DATETIME created" in graph_string | ||
mermaid_assert(graph_string) |
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,19 +1,9 @@ | ||
from paracelsus.transformers.mermaid import Mermaid | ||
|
||
from ..utils import mermaid_assert | ||
|
||
|
||
def test_mermaid(metaclass): | ||
mermaid = Mermaid(metaclass=metaclass) | ||
graph_string = str(mermaid) | ||
|
||
assert "users {" in graph_string | ||
assert "posts {" in graph_string | ||
assert "comments {" in graph_string | ||
|
||
assert "users ||--o{ posts : author" in graph_string | ||
assert "posts ||--o{ comments : post" in graph_string | ||
assert "users ||--o{ comments : author" in graph_string | ||
|
||
assert "CHAR(32) author FK" in graph_string | ||
assert 'CHAR(32) post FK "nullable"' in graph_string | ||
assert 'BOOLEAN live "True if post is published,nullable"' in graph_string | ||
assert "DATETIME created" in graph_string | ||
mermaid_assert(graph_string) |
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,13 @@ | ||
def mermaid_assert(output: str) -> None: | ||
assert "users {" in output | ||
assert "posts {" in output | ||
assert "comments {" in output | ||
|
||
assert "users ||--o{ posts : author" in output | ||
assert "posts ||--o{ comments : post" in output | ||
assert "users ||--o{ comments : author" in output | ||
|
||
assert "CHAR(32) author FK" in output | ||
assert 'CHAR(32) post FK "nullable"' in output | ||
assert 'BOOLEAN live "True if post is published,nullable"' in output | ||
assert "DATETIME created" in output |