Repository navigation
test: add comprehensive test suite for main interface functions - #7
thorwhalen wants to merge 4 commits into
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.
|
Closing: fully superseded, and merging as-is would now be a regression. This branch's substantive content (the test suite, the colorbar
Diffing this branch against current master ( Co-Authored-By: Claude Opus 5 noreply@anthropic.com |
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.