[BUG] fix test_discrete_pmf_plotting assertion, resolves #918#981
Open
rupeshca007 wants to merge 1 commit intosktime:mainfrom
Open
[BUG] fix test_discrete_pmf_plotting assertion, resolves #918#981rupeshca007 wants to merge 1 commit intosktime:mainfrom
rupeshca007 wants to merge 1 commit intosktime:mainfrom
Conversation
The test was checking len(StemContainer.get_children()) > 5, but a StemContainer always has exactly 3 children (markerline, stemlines, baseline). The correct way to count plotted support points is via stem_container.stemlines.get_segments(), which returns one segment per data point. For Binomial(n=10) there are 11 support points, so the > 5 threshold remains valid. Also removes the @pytest.mark.skip decorator since the root cause is fixed.
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
Fixes #918.
The test_discrete_pmf_plotting test was failing because the assertion
incorrectly checked
len(ax.containers[0].get_children()) > 5.A matplotlib
StemContaineralways has exactly 3 children(markerline, stemlines, baseline), regardless of how many data points
are plotted. So the check was always
3 > 5 = False.Fix
@pytest.mark.skipdecorator added as a workaround in [BUG]test_discrete_pmf_plottingis failing #918.len(stem_container.stemlines.get_segments()) > 5, which correctlycounts the number of plotted support points. For
Binomial(n=10),this is 11 (support is {0, 1, ..., 10}).
PR checklist
For all contributions
bug(diagnosed and fixed a bug) +code[BUG]