diff --git a/tests/unit_tests/gui/test_atlas_section.py b/tests/unit_tests/gui/test_atlas_section.py index db52045..efd3c07 100644 --- a/tests/unit_tests/gui/test_atlas_section.py +++ b/tests/unit_tests/gui/test_atlas_section.py @@ -10,23 +10,11 @@ from slicereg.gui.view_models.atlas_section import AtlasSectionViewModel -@pytest.fixture -def view_model() -> AtlasSectionViewModel: - MockCommandProvider = Mock(CommandProvider) - MockSignal = Mock(Signal) - model = AppModel(MockCommandProvider()) - updated = MockSignal() - view_model = AtlasSectionViewModel(axis=0, _model=model, updated=updated) - return view_model - - cases = [ (0, 'coronal_section_image'), (1, 'axial_section_image'), (2, 'sagittal_section_image'), ] - - @pytest.mark.parametrize("axis, section_attr", cases) def test_app_model_coronal_section_is_the_first_axis_of_the_atlas_volume_and_at_the_first_atlas_section_coordinate(axis, section_attr): atlas_volume = np.random.randint(0, 100, (10, 10, 10), np.uint16) @@ -44,13 +32,12 @@ def test_coronal_section_view_model_displays_the_coronal_section_image(): npt.assert_equal(app_model.coronal_section_image, view_model.section_image) - -def test_update_coords(view_model: AtlasSectionViewModel): - app_model = view_model._model - app_model.atlas_volume = np.random.randint(0, 100, (10, 10, 10), np.uint16) - app_model.atlas_section_coords = (1, 2, 3) - expected = (2, 3) - - args, kwargs = view_model.updated.emit.call_args - result = kwargs['dto'].coords - npt.assert_equal(result, expected) +def test_update_coords(): + model = AppModel( + _commands=Mock(CommandProvider), + atlas_volume=np.random.randint(0, 100, (10, 10, 10), np.uint16), + ) + view_model = AtlasSectionViewModel(axis=0, _model=model, updated=Mock(Signal)) + model.atlas_section_coords = (1, 2, 3) + result = view_model.updated.emit.call_args[1]['dto'] + npt.assert_equal(result.coords, (2, 3))