Skip to content

migrated tests from set_x to bind - #1948

Merged
dgedon merged 4 commits into
sbi-dev:gsoc-2026from
Jocho-Smith:migrate-tests-set-x-to-bind
Jul 24, 2026
Merged

migrated tests from set_x to bind#1948
dgedon merged 4 commits into
sbi-dev:gsoc-2026from
Jocho-Smith:migrate-tests-set-x-to-bind

Conversation

@Jocho-Smith

Copy link
Copy Markdown
Contributor

This PR prepares the set_x deprecation by swapping set_x with bind

@Jocho-Smith

Copy link
Copy Markdown
Contributor Author

Note that I implemented bind definitions independent from set_x (which will be implemented in #1945 everywhere). I did this here already to avoid recursion errors.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.43%. Comparing base (587f922) to head (eed5805).
⚠️ Report is 42 commits behind head on gsoc-2026.

Additional details and impacted files
@@              Coverage Diff              @@
##           gsoc-2026    #1948      +/-   ##
=============================================
- Coverage      87.99%   87.43%   -0.57%     
=============================================
  Files            144      144              
  Lines          13499    14312     +813     
=============================================
+ Hits           11879    12514     +635     
- Misses          1620     1798     +178     
Flag Coverage Δ
fast 81.51% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 12 files with indirect coverage changes

@dgedon dgedon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again make sure to import things on file level. Otherwise this PR is fine.

Also can you run tests to see if we still call at some point .set_x(). This should be visible now with the deprecation warning. No more .set_x() calls should be within the internals of the package, at this point, right? So only users would get the deprecation warning if they explicitly use `.set_x() in their workflow.

@Jocho-Smith

Jocho-Smith commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Again make sure to import things on file level.

I think I'll wait until #1945 and #1946 are merged to gsoc-2026.

No more .set_x() calls should be within the internals of the package, at this point, right?

Exactly.

I found this mini exception here. Will take care of it.

@Jocho-Smith
Jocho-Smith requested a review from dgedon July 23, 2026 13:17
Comment thread tests/inference_on_device_test.py Outdated

def bind(self, x_o: torch.Tensor, x_is_iid: bool = True) -> "FakePotential":
"""Create new potential with x bound, without mutable state."""
from sbi.utils.user_input_checks import process_x

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can yuou move this to file level?

Comment thread tests/inference_on_device_test.py Outdated

def bind(self, x_o: torch.Tensor, x_is_iid: bool = True) -> "FakePotential":
"""Create new potential with x bound, without mutable state."""
from sbi.utils.user_input_checks import process_x

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can yuou move this to file level?

@dgedon
dgedon merged commit e6f611e into sbi-dev:gsoc-2026 Jul 24, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants