-
Notifications
You must be signed in to change notification settings - Fork 0
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
error thrown when provided invalid uid #84
Conversation
Cool! I left one comment. Also, think you could add a test here to make sure that an invalid PMID throws an error? Pytest supports out of the box: https://docs.pytest.org/en/reorganize-docs/new-docs/user/pytest_raises.html |
Hey @JohnGiorgi, I'm not exactly sure why this codecov/patch check is failing. |
Don't worry about that! Can you add a test that checks that this error is thrown for an invalid pmid? I linked some relevant pytest documentation above |
Hey @JohnGiorgi, I was trying something like this: import pytest
from fastapi.exceptions import HTTPException
from semantic_search import ncbi
from semantic_search.ncbi import uids_to_docs
def test_invalid_uid_test():
with pytest.raises(HTTPException):
uid = ['93846392868']
uids_to_docs(uid) However, the def test_invalid_uid_test():
with pytest.raises(HTTPException):
uid = ['93846392868']
> uids_to_docs(uid)
E Failed: DID NOT RAISE <class 'fastapi.exceptions.HTTPException'>
tests/test_ncbi.py:11: Failed Do I need to actually start up the |
Weird! No I don't think we need to start the app unless I am really misunderstanding. What if you just remove the "with" statement and see what kind of error is raised for that PMID |
When I send that request on Insomnia with this |
It is |
Oh I see, I was going to call the whole process but this works now, I have updated it. |
Co-authored-by: John Giorgi <[email protected]>
LGTM! |
This handles the scenario when only a
uid
is provided without the text and thisuid
is invalid. The response looks like this:P.S. I made an accidental pull request before this, but I closed it. Hopefully that doesn't cause any issues.
closes #81