From 45b7c92e60af0f19539e520416ab6444f6a012d5 Mon Sep 17 00:00:00 2001 From: ouhammou rachid <93659459+ouhammmourachid@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:54:59 +0100 Subject: [PATCH] Move test folder (#161) * chore: Update deploy-docs.yml to include main branch and docs folder * remove __init__.py in mermaid/tests * refactor: Update Icon class to use version instead of str_ * refactor: Update Icon class to use version instead of str_ --- .github/workflows/deploy-docs.yml | 4 +++- mermaid/icon.py | 8 ++++---- {mermaid/tests => tests}/__init__.py | 0 {mermaid/tests => tests}/test_configuration.py | 0 {mermaid/tests => tests}/test_erdiagram.py | 0 {mermaid/tests => tests}/test_flowchart.py | 0 {mermaid/tests => tests}/test_graph.py | 0 tests/test_icon.py | 15 +++++++++++++++ {mermaid/tests => tests}/test_mermaid.py | 0 {mermaid/tests => tests}/test_mindmap.py | 0 {mermaid/tests => tests}/test_piechart.py | 0 .../tests => tests}/test_requirementdiagram.py | 0 {mermaid/tests => tests}/test_sequence.py | 0 {mermaid/tests => tests}/test_statediagram.py | 0 {mermaid/tests => tests}/test_style.py | 0 {mermaid/tests => tests}/test_user_journey.py | 0 {mermaid/tests => tests}/test_utils.py | 0 17 files changed, 22 insertions(+), 5 deletions(-) rename {mermaid/tests => tests}/__init__.py (100%) rename {mermaid/tests => tests}/test_configuration.py (100%) rename {mermaid/tests => tests}/test_erdiagram.py (100%) rename {mermaid/tests => tests}/test_flowchart.py (100%) rename {mermaid/tests => tests}/test_graph.py (100%) create mode 100644 tests/test_icon.py rename {mermaid/tests => tests}/test_mermaid.py (100%) rename {mermaid/tests => tests}/test_mindmap.py (100%) rename {mermaid/tests => tests}/test_piechart.py (100%) rename {mermaid/tests => tests}/test_requirementdiagram.py (100%) rename {mermaid/tests => tests}/test_sequence.py (100%) rename {mermaid/tests => tests}/test_statediagram.py (100%) rename {mermaid/tests => tests}/test_style.py (100%) rename {mermaid/tests => tests}/test_user_journey.py (100%) rename {mermaid/tests => tests}/test_utils.py (100%) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 72dffd6..017d26e 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -3,7 +3,9 @@ name: deploy docs on: push: branches: - - docs/* + - main + paths: + - 'docs/**' workflow_dispatch: diff --git a/mermaid/icon.py b/mermaid/icon.py index 0b106c3..b15f834 100644 --- a/mermaid/icon.py +++ b/mermaid/icon.py @@ -5,11 +5,11 @@ class Icon: name: str type_: str - str_: str = 'v1' + version: str = 'v1' def __str__(self) -> str: - if self.str_ == 'v1': - return f'{self.type_} {self.name}' - elif self.str_ == 'v2': + if self.version == 'v1': return f'{self.type_} {self.name}' + elif self.version == 'v2': + return f'{self.type_}:{self.name}' return f' {self.type_}:{self.name} ' diff --git a/mermaid/tests/__init__.py b/tests/__init__.py similarity index 100% rename from mermaid/tests/__init__.py rename to tests/__init__.py diff --git a/mermaid/tests/test_configuration.py b/tests/test_configuration.py similarity index 100% rename from mermaid/tests/test_configuration.py rename to tests/test_configuration.py diff --git a/mermaid/tests/test_erdiagram.py b/tests/test_erdiagram.py similarity index 100% rename from mermaid/tests/test_erdiagram.py rename to tests/test_erdiagram.py diff --git a/mermaid/tests/test_flowchart.py b/tests/test_flowchart.py similarity index 100% rename from mermaid/tests/test_flowchart.py rename to tests/test_flowchart.py diff --git a/mermaid/tests/test_graph.py b/tests/test_graph.py similarity index 100% rename from mermaid/tests/test_graph.py rename to tests/test_graph.py diff --git a/tests/test_icon.py b/tests/test_icon.py new file mode 100644 index 0000000..09abf60 --- /dev/null +++ b/tests/test_icon.py @@ -0,0 +1,15 @@ +import unittest + +from mermaid.icon import Icon + + +class TestIcon(unittest.TestCase): + def setUp(self) -> None: + self.icon_v1 = Icon('icon', 'fa') + self.icon_v2 = Icon('icon', 'fa', version='v2') + self.icon_v3 = Icon('icon', 'fa', version='v3') + + def test_str(self): + self.assertEqual(str(self.icon_v1), 'fa icon') + self.assertEqual(str(self.icon_v2), 'fa:icon') + self.assertEqual(str(self.icon_v3), ' fa:icon ') diff --git a/mermaid/tests/test_mermaid.py b/tests/test_mermaid.py similarity index 100% rename from mermaid/tests/test_mermaid.py rename to tests/test_mermaid.py diff --git a/mermaid/tests/test_mindmap.py b/tests/test_mindmap.py similarity index 100% rename from mermaid/tests/test_mindmap.py rename to tests/test_mindmap.py diff --git a/mermaid/tests/test_piechart.py b/tests/test_piechart.py similarity index 100% rename from mermaid/tests/test_piechart.py rename to tests/test_piechart.py diff --git a/mermaid/tests/test_requirementdiagram.py b/tests/test_requirementdiagram.py similarity index 100% rename from mermaid/tests/test_requirementdiagram.py rename to tests/test_requirementdiagram.py diff --git a/mermaid/tests/test_sequence.py b/tests/test_sequence.py similarity index 100% rename from mermaid/tests/test_sequence.py rename to tests/test_sequence.py diff --git a/mermaid/tests/test_statediagram.py b/tests/test_statediagram.py similarity index 100% rename from mermaid/tests/test_statediagram.py rename to tests/test_statediagram.py diff --git a/mermaid/tests/test_style.py b/tests/test_style.py similarity index 100% rename from mermaid/tests/test_style.py rename to tests/test_style.py diff --git a/mermaid/tests/test_user_journey.py b/tests/test_user_journey.py similarity index 100% rename from mermaid/tests/test_user_journey.py rename to tests/test_user_journey.py diff --git a/mermaid/tests/test_utils.py b/tests/test_utils.py similarity index 100% rename from mermaid/tests/test_utils.py rename to tests/test_utils.py