Skip to content

Refactor division by zero error test in test_tth_to_d#260

Merged
sbillinge merged 4 commits into
diffpy:mainfrom
bobleesj:pytest-divide-zero
Dec 21, 2024
Merged

Refactor division by zero error test in test_tth_to_d#260
sbillinge merged 4 commits into
diffpy:mainfrom
bobleesj:pytest-divide-zero

Conversation

@bobleesj
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread tests/test_transforms.py

@pytest.mark.parametrize(
"q, expected_d",
"q, expected_d, warning_expected",
Copy link
Copy Markdown
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 having warning_expected explicitly provides a quick overview whether each test case provides a warning or not. @sbillinge how do you like it?

Comment thread tests/test_transforms.py
@bobleesj
Copy link
Copy Markdown
Contributor Author

@sbillinge ready for review - again bite size PR

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (27f433d) to head (765c9e2).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #260   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          380       387    +7     
=========================================
+ Hits           380       387    +7     
Files with missing lines Coverage Δ
tests/test_transforms.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Copy link
Copy Markdown
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

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

pls see inline

Comment thread news/pytest-handle-warning.rst Outdated
@@ -0,0 +1,23 @@
**Added:**

* No news added
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this woul benefit from a news.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread tests/test_transforms.py
# UC1: User specified empty q values
(np.array([]), np.array([])),
# UC2: User specified valid q values
# Case 1: empty q values, expect empty d values
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's put a high level contextual statement always to make it easier to review. To see what I mean you could look at my edits to the PR on scale_to and eq.

Here it would be something like

# test conversion of q to d with good values
# Case 1: empty q values, expect empty d values

...

# Case 2: valid q values, expect d values without warning

...

Case 3.  valid q values containing 0, expect d values with divide by zero warning 

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

@bobleesj
Copy link
Copy Markdown
Contributor Author

pls see inline

@sbillinge ready for review - added higher-level test comment and also news file.

There are still two dozen warnings. I will address them in separate PRs.

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