-
Notifications
You must be signed in to change notification settings - Fork 10
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
adding tests to utils.py #45
adding tests to utils.py #45
Conversation
tests/test_utils.py
Outdated
|
||
|
||
@mock.patch("builtins.open") | ||
@mock.patch("json.load", mock.MagicMock(side_effect=[{"test": "test"}])) |
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.
MagicMock
is automatically used by patch
, just add directly the side effect:
@mock.patch("json.load", side_effect=[{"test": "test"}])
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.
Thank you for testing read_json
just a slight change and it will be good to goo!
tests/test_utils.py
Outdated
""" | ||
Tests when the JSON file is not found. | ||
""" | ||
with TestCase.assertRaises(TestCase, FileNotFoundError): |
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.
Please use pytest.raises
(docs):
with pytest.raises(FileNotFoundError):
...
If you could also make this change for line 67 it will be greatly appreciated
@stevencartavia CI is failing, please check the errors and fix them |
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.
LGTM!
Added tests for the read_json function from the utils.py file.