diff --git a/README.md b/README.md index d285989..8316567 100644 --- a/README.md +++ b/README.md @@ -167,9 +167,9 @@ docker start plantumlserver ## Python API -For example, to create the diagram of the classes used by `py2puml`: +For example, to create the diagram of the domain classes used by `py2puml`: -* import the `py2puml` function in your script (see [py2puml/example.py](py2puml/example.py)): +* import the `py2puml` function in your script: ```python from py2puml.py2puml import py2puml @@ -179,11 +179,11 @@ if __name__ == '__main__': print(''.join(py2puml('py2puml/domain', 'py2puml.domain'))) # writes the PlantUML content in a file - with open('py2puml/domain.puml', 'w') as puml_file: + with open('py2puml/py2puml.domain.puml', 'w', encoding='utf8') as puml_file: puml_file.writelines(py2puml('py2puml/domain', 'py2puml.domain')) ``` -* running it (`python3 -m py2puml.example`) outputs the previous PlantUML diagram in the terminal and writes it in a file. +* running it outputs the previous PlantUML diagram in the terminal and writes it in a file. # Tests @@ -199,7 +199,7 @@ python3 -m pytest -v Code coverage (with [missed branch statements](https://pytest-cov.readthedocs.io/en/latest/config.html?highlight=--cov-branch)): ```sh -poetry run pytest -v --cov=py2puml --cov-branch --cov-report term-missing --cov-fail-under 92 +poetry run pytest -v --cov=py2puml --cov-branch --cov-report term-missing --cov-fail-under 93 ``` # Changelog diff --git a/py2puml/example.py b/py2puml/example.py deleted file mode 100644 index c43af83..0000000 --- a/py2puml/example.py +++ /dev/null @@ -1,9 +0,0 @@ -from py2puml.py2puml import py2puml - -if __name__ == '__main__': - # outputs the PlantUML content in the terminal - print(''.join(py2puml('py2puml/domain', 'py2puml.domain'))) - - # writes the PlantUML content in a file - with open('py2puml/py2puml.domain.puml', 'w', encoding='utf8') as puml_file: - puml_file.writelines(py2puml('py2puml/domain', 'py2puml.domain')) diff --git a/tests/py2puml/parsing/test_moduleresolver.py b/tests/py2puml/parsing/test_moduleresolver.py index 6dbc374..a00b096 100644 --- a/tests/py2puml/parsing/test_moduleresolver.py +++ b/tests/py2puml/parsing/test_moduleresolver.py @@ -50,3 +50,9 @@ def test_ModuleResolver_get_module_full_name(): source_module = MockedInstance({'__name__': 'tests.modules.withconstructor'}) module_resolver = ModuleResolver(source_module) assert module_resolver.get_module_full_name() == 'tests.modules.withconstructor' + + +def test_ModuleResolver_repr(): + source_module = MockedInstance({'__name__': 'tests.modules.withconstructor'}) + module_resolver = ModuleResolver(source_module) + assert module_resolver.__repr__() == 'ModuleResolver({"__name__": "tests.modules.withconstructor"})'