Skip to content

Commit

Permalink
build: improve code coverage (added tests, removed irrelevant code)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucsorel committed Aug 5, 2023
1 parent 7576ce6 commit 00cfd98
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 0 additions & 9 deletions py2puml/example.py

This file was deleted.

6 changes: 6 additions & 0 deletions tests/py2puml/parsing/test_moduleresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"})'

0 comments on commit 00cfd98

Please sign in to comment.