Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivieFranklova committed Oct 2, 2024
1 parent d087b50 commit ed9f215
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/py_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
pytest $TEST_FILES
- name: Show coverage
run: coverage report -m --omit=".*.ipynb"
run: coverage report -m --omit=[".*.ipynb", "similarityRunner/UI", "similarityRunner/models", "similarityRunner/runner.py"]

- name: Create coverage file
if: github.event_name == 'pull_request'
Expand Down
2 changes: 2 additions & 0 deletions test/test_runner_connectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def test_get_data_files(self):
directory_paths=[],
file_type=("csv",))
data, names = connector.get_data(settings)
connector.close()
self.assertEqual(len(data), 2)
self.assertEqual(names[0], "./data/netflix_titles")
self.assertEqual(names[1], "./data/disney_movies")
Expand All @@ -22,4 +23,5 @@ def test_get_data_folder(self):
directory_paths=["./data"],
file_type=("csv",))
data, _ = connector.get_data(settings)
connector.close()
self.assertEqual(len(data), 11)
28 changes: 28 additions & 0 deletions test/test_runner_formators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest

from formators.jason_formater import JsonFormater


class TestJsonFormater(unittest.TestCase):
def test_format_data(self):
data = {"a": {"b": 0.5, "c": 0.3},
"b": {"a": 0.5, "c": 0.8},
"c": {"a": 0.3, "b": 0.8}}
formater = JsonFormater()
jsondata = formater.format(data)
self.assertEqual(jsondata, '''{
"a": {
"b": 0.5,
"c": 0.3
},
"b": {
"a": 0.5,
"c": 0.8
},
"c": {
"a": 0.3,
"b": 0.8
}
}''')


0 comments on commit ed9f215

Please sign in to comment.