Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/pytest-warnings-others.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news added
Copy link
Contributor

Choose a reason for hiding this comment

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

please use something like:

* no news added: intercepting warnings generated by tests on purpose not needed by users or devs.

With that said, I think this probably would be good to hvae a news.....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup noted. There are other remaining warnings, etc. I will include that news item


**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
18 changes: 14 additions & 4 deletions tests/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,13 @@ def test_d_to_q(d, expected_q):
),
],
)
def test_tth_to_d(wavelength, tth, expected_d):
actual_d = tth_to_d(tth, wavelength)
def test_tth_to_d(wavelength, tth, expected_d, wavelength_warning_msg):
if wavelength is None:
with pytest.warns(UserWarning, match=re.escape(wavelength_warning_msg)):
actual_d = tth_to_d(tth, wavelength)
else:
actual_d = tth_to_d(tth, wavelength)

assert np.allclose(actual_d, expected_d)


Expand Down Expand Up @@ -221,8 +226,13 @@ def test_tth_to_d_invalid(wavelength, tth, expected_error_type, expected_error_m
),
],
)
def test_d_to_tth(wavelength, d, expected_tth):
actual_tth = d_to_tth(d, wavelength)
def test_d_to_tth(wavelength, d, expected_tth, wavelength_warning_msg):
if wavelength is None:
with pytest.warns(UserWarning, match=re.escape(wavelength_warning_msg)):
actual_tth = d_to_tth(d, wavelength)
else:
actual_tth = d_to_tth(d, wavelength)

assert np.allclose(actual_tth, expected_tth)


Expand Down
Loading