Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Small bug in bootstrap keywords #483

Merged
merged 2 commits into from
Mar 5, 2024
Merged

Conversation

alanlujan91
Copy link
Contributor

"cluster" is not a bootstrap option

Copy link

codecov bot commented Mar 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.98%. Comparing base (d7d53ec) to head (66a200d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #483   +/-   ##
=======================================
  Coverage   92.97%   92.98%           
=======================================
  Files         193      193           
  Lines       14635    14638    +3     
=======================================
+ Hits        13607    13611    +4     
+ Misses       1028     1027    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@timmens timmens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Alan! Thanks for finding this bug and directly providing a fix.

I have only a minor remark about the test, but other than that, it looks great 🎉


with pytest.raises(ValueError, match="a must be a positive integer unless no"):
get_moments_cov(
data=data,
calculate_moments=calc_moments,
moment_kwargs=moment_kwargs,
bootstrap_kwargs={"n_draws": -1},
bootstrap_kwargs={"n_draws": -1, "cluster_by": "cluster"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer not to add the cluster_by option test to this block. Here we want to check that the bootstrap kwargs are actually passed to the bootstrap function. I think for the cluster_by argument we would rather want to check that an error is thrown if an invalid option is passed. Maybe you could add something like this below:

with pytest.raises(ValueError, match="Invalid bootstrap_kwargs: {'cluster'}"):
    get_moments_cov(
        data=data,
        calculate_moments=calc_moments,
        moment_kwargs=moment_kwargs,
        bootstrap_kwargs={"cluster": "cluster"},
    )

@alanlujan91 alanlujan91 requested a review from timmens March 4, 2024 22:12
Copy link
Member

@timmens timmens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@timmens timmens merged commit 3fba00e into optimagic-dev:main Mar 5, 2024
14 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants