test: add comprehensive test suite for main interface functions#7
Open
thorwhalen wants to merge 4 commits intomasterfrom
Open
test: add comprehensive test suite for main interface functions#7thorwhalen wants to merge 4 commits intomasterfrom
thorwhalen wants to merge 4 commits intomasterfrom
Conversation
This commit adds 74 tests covering the main interface functions exported by oplot.__init__.py: - test_matrix.py: Tests for heatmap, xy_boxplot, vlines_ranges, vlines_of_matrix - test_plot_data_set.py: Tests for density_distribution, scatter_and_color_according_to_y, side_by_side_bar - test_plot_stats.py: Tests for plot_confusion_matrix, make_tables_tn_fp_fn_tp, make_normal_outlier_timeline, render_mpl_table - test_distributions.py: Tests for kdeplot_w_boundary_condition - test_multiplots.py: Tests for ax_func_to_plot - test_outlier_scores.py: Tests for plot_scores_and_zones and related functions - test_plot_mappings.py: Tests for dict_bar_plot All tests pass successfully (74/74). This provides a safety net for future changes and validates current functionality.
…o_y (#1) Fixed AttributeError: 'AxesSubplot' object has no attribute 'colorbar' that occurred when plotting with continuous y values (floats). The issue was on lines 298 and 324 where ax.colorbar() was incorrectly called. Axes objects don't have a colorbar() method in matplotlib. Changed to: - Capture the scatter plot object in variable 'sc' - Call fig.colorbar(sc, ax=ax) instead of ax.colorbar() This fix applies to both 1D and 2D projection modes when using continuous color mapping. Fixes #1
Fixed issue where make_normal_outlier_timeline didn't respect the order
of class labels when y_order parameter was None.
Previously, the function used np.unique(y) which returns sorted unique
values, discarding the original order of appearance in the data.
Changed line 399 from:
y_order = np.unique(y)
To:
y_order = list(dict.fromkeys(y))
This preserves insertion order (order of first appearance) using
dict.fromkeys(), which maintains insertion order as of Python 3.7+.
For example, if y = ['C', 'A', 'B', 'C', 'A', 'B'], the order will now
be ['C', 'A', 'B'] instead of the alphabetically sorted ['A', 'B', 'C'].
Fixes #6
Added comprehensive analysis document covering: - Main functionality overview (20+ exported functions) - Test coverage assessment (was 0%, now has 74 tests) - Documentation quality evaluation (excellent README) - Detailed analysis of all 4 open issues: * #1: Fixed - colorbar AttributeError * #3: Enhancement request - needs user clarification * #5: Bug report - needs reproduction steps * #6: Fixed - class ordering not preserved - Resolution strategy and commit plan - Testing approach and priorities - Recommendations for future work This document provides a complete record of the comprehensive repository improvement effort and serves as reference for maintainers.
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.
This commit adds 74 tests covering the main interface functions exported
by oplot.init.py:
All tests pass successfully (74/74). This provides a safety net for future
changes and validates current functionality.