1+ from copy import copy
12from pathlib import Path
23from typing import MutableSequence
34
@@ -466,7 +467,7 @@ def test_positions_setter_invalid(self, valid_data_array_no_xy_coords, coordinat
466467 with pytest .raises (ValueError , match = f'Cannot set { coordinate } before setting all physical coordinate positions.' ):
467468 setattr (measurement , coordinate , sc .arange ('x' , 0 , 10 , 1 , unit = 'm' ))
468469
469- # Just a single test, other test-cases is covered by from_tiff_stack tests as both uses _validate_provided_coord()
470+ # Just a single test, other test-cases are covered by from_tiff_stack tests as both use _validate_provided_coord()
470471 @pytest .mark .parametrize ('coordinate' , ['x_positions' , 'y_positions' ], ids = ['x_coordinate' , 'y_coordinate' ])
471472 def test_positions_setter_invalid_coordinate (self , valid_data_array , coordinate ):
472473 # When
@@ -489,7 +490,7 @@ def test_set_physical_coord_positions_valid(self, valid_data_array_no_xy_coords)
489490 assert sc .identical (measurement ._data_array .coords ['y' ], new_y_positions )
490491 assert measurement ._has_physical_coords
491492
492- # Just a single test for each, other test-cases is covered by from_tiff_stack tests as both uses _validate_provided_coord()
493+ # Just a single test for each, other test-cases are covered by from_tiff_stack tests as both use _validate_provided_coord()
493494 @pytest .mark .parametrize (
494495 'coordinates, coordinate_wrong' ,
495496 [
@@ -587,12 +588,15 @@ def test_regions_of_interest(self, valid_data_array, valid_roi):
587588 def test_regions_of_interest_removal_by_index (self , valid_data_array , valid_roi ):
588589 # When
589590 measurement = Measurement (data_array = valid_data_array )
591+ extra_roi = copy (valid_roi )
590592 measurement .regions_of_interest .append (valid_roi )
593+ measurement .regions_of_interest .append (extra_roi ) # Add a second ROI to ensure only the correct one is removed
591594 # Then
592595 del measurement .regions_of_interest [0 ]
593596 # Expect
594- assert len (measurement .regions_of_interest ) == 0
597+ assert len (measurement .regions_of_interest ) == 1
595598 assert valid_roi not in measurement .regions_of_interest
599+ assert extra_roi in measurement .regions_of_interest
596600
597601 def test_regions_of_interest_removal_by_name (self , valid_data_array , valid_roi ):
598602 # When
0 commit comments