Skip to content

Commit 71fcb6b

Browse files
committed
Re-design error msg on how to modify all_arrays
1 parent 3ba3038 commit 71fcb6b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/diffpy/utils/diffraction_objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ def all_arrays(self):
188188
@all_arrays.setter
189189
def all_arrays(self, value):
190190
raise AttributeError(
191-
"Direct modification of 'all_arrays' is not allowed."
192-
"Please use 'insert_scattering_quantity' to modify it."
191+
"Direct modification of attribute 'all_arrays' is not allowed."
192+
"Please use 'insert_scattering_quantity' to modify `all_arrays`."
193193
)
194194

195195
def set_angles_from_list(self, angles_list):

tests/test_diffraction_objects.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,9 @@ def test_all_array_setter():
369369
actual_do = DiffractionObject()
370370

371371
# Attempt to directly modify the property
372-
with pytest.raises(AttributeError, match="Direct modification of 'all_arrays' is not allowed."):
372+
with pytest.raises(
373+
AttributeError,
374+
match="Direct modification of attribute 'all_arrays' is not allowed."
375+
"Please use 'insert_scattering_quantity' to modify `all_arrays`.",
376+
):
373377
actual_do.all_arrays = np.empty((4, 4))

0 commit comments

Comments
 (0)