Skip to content
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

Allow to disable Entrez search result limit #18

Merged
merged 4 commits into from
Oct 12, 2023

Conversation

jonasfreimuth
Copy link
Contributor

@jonasfreimuth jonasfreimuth commented Oct 9, 2023

Fixes the limit on max_results for EntrezAPI.search() and adds an option to ignore all similar limits.

Should pretty much close #16, at least for my purposes.

Note: Running pytest on commit 3c2b396 resulted in the following output once, but the error disappeared after I ran it again without changing anything, the programmers dream nightmare.

(.venv) jfreige@sl-akali-p-cs1:easy-entrez (16-entrez-result-limit)$ pytest
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.10.12, pytest-7.4.2, pluggy-1.3.0
rootdir: /data/local/jfreige/geo-mining/easy-entrez
plugins: cov-4.1.0
collected 15 items                                                                                                                                                                                               

tests/test_api.py ..F                                                                                                                                                                                      [ 20%]
tests/test_parsing.py ....                                                                                                                                                                                 [ 46%]
tests/test_queries.py ........                                                                                                                                                                             [100%]

==================================================================================================== FAILURES ====================================================================================================
___________________________________________________________________________________________________ test_fetch ___________________________________________________________________________________________________

    def test_fetch():
        result = entrez_api.fetch(['4'], max_results=1, database='snp')
        assert is_response_for(result, FetchQuery)
        assert not is_response_for(result, SearchQuery)
        snp = result.data[0]
        namespaces = {'ns0': 'https://www.ncbi.nlm.nih.gov/SNP/docsum'}
>       chromosome = snp.find('.//ns0:CHR', namespaces).text
E       AttributeError: 'NoneType' object has no attribute 'text'

tests/test_api.py:38: AttributeError
================================================================================================ warnings summary ================================================================================================
tests/test_parsing.py:39
  /data/local/jfreige/geo-mining/easy-entrez/tests/test_parsing.py:39: PytestUnknownMarkWarning: Unknown pytest.mark.optional - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.optional

tests/test_parsing.py:78
  /data/local/jfreige/geo-mining/easy-entrez/tests/test_parsing.py:78: PytestUnknownMarkWarning: Unknown pytest.mark.optional - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.optional

tests/test_parsing.py:89
  /data/local/jfreige/geo-mining/easy-entrez/tests/test_parsing.py:89: PytestUnknownMarkWarning: Unknown pytest.mark.optional - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
    @pytest.mark.optional

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================ short test summary info =============================================================================================
FAILED tests/test_api.py::test_fetch - AttributeError: 'NoneType' object has no attribute 'text'
==================================================================================== 1 failed, 14 passed, 3 warnings in 4.47s ====================================================================================```

@jonasfreimuth
Copy link
Contributor Author

Ok hold on while I sign my commits...

@jonasfreimuth
Copy link
Contributor Author

Also, yes, I've noticed the error above is different to the one mentioned in #19, and will be looking into if this is a problem.

@jonasfreimuth jonasfreimuth marked this pull request as draft October 10, 2023 18:45
@jonasfreimuth jonasfreimuth marked this pull request as ready for review October 10, 2023 21:16
@jonasfreimuth
Copy link
Contributor Author

I don't think the readthedocs fail has anything to do with this PR, right?

@krassowski
Copy link
Owner

Hi @jonasfreimuth thank you for this!

Can you please merge with the main branch which now includes a fix for the docs (#20) so that we can see if they build properly?

@krassowski krassowski added the enhancement New feature or request label Oct 12, 2023
@jonasfreimuth
Copy link
Contributor Author

Will do, hang on.

@jonasfreimuth
Copy link
Contributor Author

Ok it's merged. @krassowski you might have to manually allow the other checks to run again...

Copy link
Owner

@krassowski krassowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jonasfreimuth

@krassowski krassowski changed the title 16 entrez result limit Allow to disable Entrez search result limit Oct 12, 2023
@krassowski krassowski merged commit 16234a8 into krassowski:main Oct 12, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entrez search result limit
2 participants