chanzuckerberg / cellxgene-ontology-guide

MIT License
3 stars 0 forks source link

chore: add doctesting to API #176

Closed Bento007 closed 6 months ago

Bento007 commented 6 months ago

Reason for Change

Changes

Testing steps

Notes for Reviewer

Here is an example of what was seen: when run this

        >>> from cellxgene_ontology_guide.ontology_parser import OntologyParser
        >>> ontology_parser = OntologyParser()
        >>> ontology_parser.map_term_descendants(["CL:0000003", "CL:0000005"], include_self=True)
        {'CL:0000003': ['CL:0000003'], 'CL:0000005': ['CL:0000005', 'CL:0002363']}

while when running with doctest:

_________________________________________________________ [doctest] cellxgene_ontology_guide.ontology_parser.OntologyParser.map_term_descendants __________________________________________________________
306 
307         Get the descendant ontology terms for each term in a list. If include_self is True, the term itself will be
308          included as a descendant.
309 
310         Example
311         >>> from cellxgene_ontology_guide.ontology_parser import OntologyParser
312         >>> ontology_parser = OntologyParser()
313         >>> ontology_parser.map_term_descendants(["CL:0000003", "CL:0000005"], include_self=True)
Expected:
    {
        'CL:0000003': ['CL:0000003', 'CL:0000004', ...],
        'CL:0000005': ['CL:0000005', 'CL:0002363', ...]
    }
Got:
    {'CL:0000003': ['CL:0000003', 'CL:0000003'], 'CL:0000005': ['CL:0000005', 'CL:0000005', 'CL:0002363']}
Bento007 commented 6 months ago

we can always +SKIP verifying the output. That way we check that the code still runs without needing to keep the output up to date. Though that means if the output shape changes we need to remember to update docstrings examples to reflect.

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.72%. Comparing base (a90341b) to head (697b5c4).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #176 +/- ## ========================================== + Coverage 84.62% 84.72% +0.10% ========================================== Files 19 19 Lines 969 969 Branches 186 186 ========================================== + Hits 820 821 +1 + Misses 139 138 -1 Partials 10 10 ``` | [Flag](https://app.codecov.io/gh/chanzuckerberg/cellxgene-ontology-guide/pull/176/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/chanzuckerberg/cellxgene-ontology-guide/pull/176/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg) | `84.72% <ø> (+0.10%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=chanzuckerberg#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.