Add comprehensive tests: coverage from 54% to 97%#13
Draft
Conversation
Agent-Logs-Url: https://github.com/CostaLab/pyCrossTalkeR/sessions/5897d241-aa30-411e-9f49-eef0fafe5988 Co-authored-by: jsnagai <8943000+jsnagai@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CostaLab/pyCrossTalkeR/sessions/5897d241-aa30-411e-9f49-eef0fafe5988 Co-authored-by: jsnagai <8943000+jsnagai@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CostaLab/pyCrossTalkeR/sessions/5897d241-aa30-411e-9f49-eef0fafe5988 Co-authored-by: jsnagai <8943000+jsnagai@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jsnagai
April 1, 2026 15:25
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR significantly improves the test coverage of pyCrossTalkeR from 54% to 97% by adding 75 new tests and fixing two pre-existing bugs found during test writing.
New files
test/helpers.pySEL_COLUMNSconstant andmake_lr_df()synthetic-data factorytest/__init__.pytest/a proper package sohelpers.pyis importabletest/conftest.pyanalysed_adatapytest fixture (synthetic CTR + EXP conditions)test/test_coverage.pyCoverage per module
tools/utils.pytools/Single_Condition.pytools/Comparative_condition.pyplots/plot.pyWhat is tested
utils.py:add_node_type, graph JSON serialization (including numpy scalar edge attrs),get_clustered_node_order,create_ordered_circular_layout,ranking_net(signed + unsigned modes),comparative_pagerank/comparative_med,fisher_test_cciandmannwhitneyu_test_cciwith explicitcomparisonparameter,from_liana(DataFrame path with label, dict path,pval_filter,compute_means)Single_Condition.py: dict-of-CSV-paths input, invalid input types (ValueError), receptor-first gene orderingComparative_condition.py: explicitcomparisonparameter, multiple comparison pairsplots/plot.py:plot_cciwithlog=True, single-coord,emax;plot_bar_rankingswith alltypefilter lengths (1/2/3 chars),filter_signpos/neg, empty result message;plot_clustermapandplot_graph_clustermap;plot_volcanewith annotated red points;plot_pca_LR_comparative(non-ggi, ggi withgene_types,include_tf=True);plot_sankeyall filter branches;gen_sankey2Bug fixes
plot_bar_rankingsfilter_sign(plots/plot.pyline 337–339): Referenced hardcoded string'ranking'instead of therankingparameter, always raisingKeyError. Fixed to use the variable.plot_pca_LR_comparativeinclude_tf=True(plots/plot.pyline 195): Usedpd.DataFrame(pca_df.index, columns=["gene"])which returns an empty DataFrame in pandas 2.x when the index originates from a.loc[]call. Fixed topd.DataFrame({"gene": pca_df.index}).Remaining uncovered lines (3%)
utils.py458, 509: Dead code —B <= 0branch,Bis hardcoded to 1000plot.py187:gene_types="TF"in ggi mode produces empty PCA → crashplot.py227: PCA text annotation only fires when a point is >4σ (not reproducible with small synthetic data)plot.py415, 421: Legacy data handling when gene names don't yet have|separatorsplot.py683–716:gene_annotation()— requires live external gProfiler API callgenerate_report.py80:save=Truebranch — requires a filesystem output path