Skip to content

Fix all remaining divide by zero pytest warnings #262

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 21, 2024

Conversation

bobleesj
Copy link
Contributor

Closes #223

Screenshot 2024-12-21 at 2 13 04 PM

This PR focused on catching warnings. In the following PRs, I will focus on checking test comments and refactoring into reusable components with conftest.py

),
]


@pytest.mark.parametrize(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just moving them under @pytest.mark.parametrize - no numbers have been modified.



@pytest.mark.parametrize("init_args, expected_error_msg", test_init_invalid_params)
@pytest.mark.parametrize(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will further refine these comments with higher level commets, etc. in the following PRs (issues have been created for these)

Copy link

codecov bot commented Dec 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9bd388d) to head (3287747).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #262   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          391       404   +13     
=========================================
+ Hits           391       404   +13     
Files with missing lines Coverage Δ
tests/test_diffraction_objects.py 100.00% <100.00%> (ø)
tests/test_transforms.py 100.00% <100.00%> (ø)

Copy link
Contributor Author

@bobleesj bobleesj left a comment

Choose a reason for hiding this comment

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

@sbillinge ready for review - no numbers have been modified.

def test_d_to_tth(wavelength, d, expected_tth, wavelength_warning_msg):
if wavelength is None:
def test_d_to_tth(wavelength, d, expected_tth, divide_by_zero_warning_expected, wavelength_warning_msg):
if wavelength is None and not divide_by_zero_warning_expected:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am thinking we could make a reusable test util function under conftest.py - that takes in d_to_tth, tth_to_d, etc and capture these warning messages.

@sbillinge sbillinge merged commit 4bc2d05 into diffpy:main Dec 21, 2024
5 checks passed
@bobleesj bobleesj deleted the pytest-warning-zero-divide branch December 21, 2024 21:36
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.

31 pytest warnings - wavelength zero, infinite array, divide by zero
2 participants