@@ -705,7 +705,7 @@ def test_copy_object(do_minimal):
705705
706706
707707@pytest .mark .parametrize (
708- "starting_all_arrays, scalar_value , expected_all_arrays" ,
708+ "starting_all_arrays, scalar_to_add , expected_all_arrays" ,
709709 [
710710 # Test scalar addition to xarray values (q, tth, d) and expect no change to yarray values
711711 ( # C1: Add integer of 5, expect xarray to increase by by 5
@@ -720,11 +720,13 @@ def test_copy_object(do_minimal):
720720 ),
721721 ],
722722)
723- def test_addition_operator_by_scalar (starting_all_arrays , scalar_value , expected_all_arrays , do_minimal_tth ):
723+ def test_addition_operator_by_scalar (starting_all_arrays , scalar_to_add , expected_all_arrays , do_minimal_tth ):
724724 do = do_minimal_tth
725725 assert np .allclose (do .all_arrays , starting_all_arrays )
726- do_sum = do + scalar_value
727- assert np .allclose (do_sum .all_arrays , expected_all_arrays )
726+ do_sum_RHS = do + scalar_to_add
727+ do_sum_LHS = scalar_to_add + do
728+ assert np .allclose (do_sum_RHS .all_arrays , expected_all_arrays )
729+ assert np .allclose (do_sum_LHS .all_arrays , expected_all_arrays )
728730
729731
730732@pytest .mark .parametrize (
@@ -750,10 +752,12 @@ def test_addition_operator_by_another_do(LHS_all_arrays, RHS_all_arrays, expecte
750752
751753def test_addition_operator_invalid_type (do_minimal_tth , invalid_add_type_error_msg ):
752754 # Add a string to a DO object, expect TypeError, only scalar (int, float) allowed for addition
753- do_LHS = do_minimal_tth
755+ do = do_minimal_tth
754756 with pytest .raises (TypeError , match = re .escape (invalid_add_type_error_msg )):
755- do_LHS + "string_value"
756-
757+ do + "string_value"
758+ with pytest .raises (TypeError , match = re .escape (invalid_add_type_error_msg )):
759+ "string_value" + do
760+
757761
758762def test_addition_operator_invalid_xarray_length (do_minimal , do_minimal_tth , x_grid_size_mismatch_error_msg ):
759763 # Combine two DO objects, one with empty xarrays (do_minimal) and the other with non-empty xarrays
0 commit comments