Skip to content

Commit

Permalink
Formatting and Tests Update
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleDan9 committed Sep 26, 2024
1 parent 0a06110 commit aa436f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions paracelsus/transformers/dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, metaclass: MetaData, column_sort: str) -> None:
for column in table.columns:
for foreign_key in column.foreign_keys:
key_parts = foreign_key.target_fullname.split(".")
left_table = '.'.join(key_parts[:-1])
left_table = ".".join(key_parts[:-1])
left_column = key_parts[-1]

# We don't add the connection to the fk table if the latter
Expand All @@ -40,7 +40,7 @@ def __init__(self, metaclass: MetaData, column_sort: str) -> None:
)
continue

edge = pydot.Edge(left_table.split('.')[-1], table.name)
edge = pydot.Edge(left_table.split(".")[-1], table.name)
edge.set_label(column.name)
edge.set_dir("both")

Expand Down
2 changes: 1 addition & 1 deletion paracelsus/transformers/mermaid.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _relationships(self, column: Column) -> str:

for foreign_key in column.foreign_keys:
key_parts = foreign_key.target_fullname.split(".")
left_table = '.'.join(key_parts[:-1])
left_table = ".".join(key_parts[:-1])
left_column = key_parts[-1]
left_operand = ""

Expand Down
12 changes: 6 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def dot_full_string_preseve_column_sort() -> str:
<tr><td align="left">VARCHAR(100)</td><td align="left">display_name</td><td></td></tr>
<tr><td align="left">DATETIME</td><td align="left">created</td><td></td></tr>
</table>
>, margin=0, shape=none];
>, shape=none, margin=0];
posts [label=<
<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
<tr><td colspan="3" bgcolor="lightblue"><b>posts</b></td></tr>
Expand All @@ -105,8 +105,8 @@ def dot_full_string_preseve_column_sort() -> str:
<tr><td align="left">BOOLEAN</td><td align="left">live</td><td></td></tr>
<tr><td align="left">TEXT</td><td align="left">content</td><td></td></tr>
</table>
>, margin=0, shape=none];
users -- posts [arrowhead=crow, arrowtail=none, dir=both, label=author];
>, shape=none, margin=0];
users -- posts [label=author, dir=both, arrowhead=crow, arrowtail=none];
comments [label=<
<table border="0" cellborder="1" cellspacing="0" cellpadding="4">
<tr><td colspan="3" bgcolor="lightblue"><b>comments</b></td></tr>
Expand All @@ -117,8 +117,8 @@ def dot_full_string_preseve_column_sort() -> str:
<tr><td align="left">BOOLEAN</td><td align="left">live</td><td></td></tr>
<tr><td align="left">TEXT</td><td align="left">content</td><td></td></tr>
</table>
>, margin=0, shape=none];
posts -- comments [arrowhead=crow, arrowtail=none, dir=both, label=post];
users -- comments [arrowhead=crow, arrowtail=none, dir=both, label=author];
>, shape=none, margin=0];
posts -- comments [label=post, dir=both, arrowhead=crow, arrowtail=none];
users -- comments [label=author, dir=both, arrowhead=crow, arrowtail=none];
}
"""
6 changes: 3 additions & 3 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ def dot_assert(output: str) -> None:
assert '<tr><td colspan="3" bgcolor="lightblue"><b>posts</b></td></tr>' in output
assert '<tr><td colspan="3" bgcolor="lightblue"><b>comments</b></td></tr>' in output

assert "users -- posts [arrowhead=crow, arrowtail=none, dir=both, label=author];" in output
assert "posts -- comments [arrowhead=crow, arrowtail=none, dir=both, label=post];" in output
assert "users -- comments [arrowhead=crow, arrowtail=none, dir=both, label=author];" in output
assert "users -- posts [label=author, dir=both, arrowhead=crow, arrowtail=none];" in output
assert "posts -- comments [label=post, dir=both, arrowhead=crow, arrowtail=none];" in output
assert "users -- comments [label=author, dir=both, arrowhead=crow, arrowtail=none];" in output

assert '<tr><td align="left">CHAR(32)</td><td align="left">author</td><td>Foreign Key</td></tr>' in output
assert '<tr><td align="left">CHAR(32)</td><td align="left">post</td><td>Foreign Key</td></tr>' in output
Expand Down

0 comments on commit aa436f3

Please sign in to comment.