Skip to content

Commit 8eaf5d7

Browse files
authored
Merge pull request #255 from bobleesj/pytest-warning
Refactor `test_scale_to` function - continue to establish good practices
2 parents 27f433d + 206d39d commit 8eaf5d7

File tree

3 files changed

+256
-220
lines changed

3 files changed

+256
-220
lines changed

news/pytest-warning.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* No news added
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/utils/transforms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"The supplied input array and wavelength will result in an impossible two-theta. "
1515
"Please check these values and re-instantiate the DiffractionObject with correct values."
1616
)
17-
inf_output_wmsg = (
17+
inf_output_imsg = (
1818
"INFO: The largest output value in the array is infinite. This is allowed, but it will not be plotted."
1919
)
2020

@@ -135,7 +135,7 @@ def q_to_d(q):
135135
The array of :math:`d` values np.array([ds]).
136136
"""
137137
if 0 in q:
138-
print(inf_output_wmsg)
138+
print(inf_output_imsg)
139139
return 2.0 * np.pi / copy(q)
140140

141141

@@ -169,7 +169,7 @@ def tth_to_d(tth, wavelength):
169169
d[i] = i
170170
return d
171171
if 0 in q:
172-
warnings.warn(inf_output_wmsg)
172+
print(inf_output_imsg)
173173
return 2.0 * np.pi / copy(q)
174174

175175

@@ -189,7 +189,7 @@ def d_to_q(d):
189189
The units of q must be reciprocal of the units of wavelength.
190190
"""
191191
if 0 in d:
192-
warnings.warn(inf_output_wmsg)
192+
print(inf_output_imsg)
193193
return 2.0 * np.pi / copy(d)
194194

195195

0 commit comments

Comments
 (0)