-
Notifications
You must be signed in to change notification settings - Fork 1
Unit tests #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Unit tests #6
Conversation
|
|
||
|
|
||
| class TestUnitls(unittest.TestCase): | ||
| def test_create_logging_instance(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me, this test is not sufficient. The create logging function is to write logs, which has not been tested.
Proposed:
- write something to the file
- read the file (filename could be worked out)
- check the content
Not sure whether it is the right version of having to_file option though
| } | ||
| }, | ||
| ] | ||
| self.assertEqual(utils.get_number_of_published_papers(data)['yes'], 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personal choice:
assertDictEqual which indicates clearly that a dict is expected
expected = {
'yes': 2,
'no': 2
}
self.assertDictEqual(utils.get_number_of_published_papers(data),expected)
applies to all other methods
| logger.error(f"Error when try to insert into index {es_index_prefix}{doc_type}: " + str(e.args)) | ||
| pprint.pprint(body) | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the commit message is not suitable for the changes
Actually could be merged to the next commit
|
General suggestion:
|
First part of unit and integration tests