Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack change units tests added to Spectrum Viewer #2235

Merged
merged 4 commits into from
Jun 24, 2024

Conversation

MikeSullivan7
Copy link
Collaborator

@MikeSullivan7 MikeSullivan7 commented Jun 21, 2024

Issue

Progresses #2213 and #2032

Description

Added unit tests to check the tof mode is changed correctly when:

  • switching from stack with no spectra file to stack with spectra file
  • switching from stack with spectra file to stack with spectra file (for tof modes ToFUnitMode.WAVELENGTH, ToFUnitMode.ENERGY, ToFUnitMode.TOF_US)
  • switching from stack with no spectra file to stack with no spectra file
  • switching from stack with spectra file to stack with no spectra file

These tests check that the tof mode is changed as expected but also if the right click units menu has the correct behaviour (i.e. disabling when there is no spectra file and enabling when there is a spectrum file).

A test has also been added to check that when there is no stack available in the spectrum viewer (i.e. it has been deleted in the Main Window), then the tof mode and right click menu behaves appropriately.

Acceptance Criteria

Test that all tests pass with make check

Documentation

Release note

@MikeSullivan7 MikeSullivan7 self-assigned this Jun 21, 2024
@MikeSullivan7 MikeSullivan7 added Quality: Testing Release 🚀 Issues related to creating a release labels Jun 21, 2024
@MikeSullivan7 MikeSullivan7 added this to the Release 2.8 milestone Jun 21, 2024
@MikeSullivan7
Copy link
Collaborator Author

Note: I have said that it progresses the issues in case we want to add some more tests to the PR :)

@MikeSullivan7 MikeSullivan7 marked this pull request as ready for review June 21, 2024 17:11
@coveralls
Copy link

Coverage Status

coverage: 73.176% (+0.2%) from 72.992%
when pulling 99d426a on 2213-spectrum-viewer-stack-units-tests
into f0433e5 on main.

@JackEAllen JackEAllen added Release essential Essential to the release - showstoppers. If not done the release might be delayed and removed Release 🚀 Issues related to creating a release labels Jun 24, 2024
self.assertEqual(self.presenter.model.tof_mode, expected_tof_mode)

@parameterized.expand([
(None, "Image Index", ToFUnitMode.IMAGE_NUMBER, np.arange(1, 10), [mock.call(False),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small tweak that reduces the wrapping. If you change [mock.call(False), mock.call(True)], to [False, True], then you can turn the into calls in the method
expected_calls = [mock.call(b) for b in expected_calls]

@coveralls
Copy link

Coverage Status

coverage: 73.229% (+0.2%) from 72.992%
when pulling fbc701d on 2213-spectrum-viewer-stack-units-tests
into f0433e5 on main.

Copy link
Collaborator

@samtygier-stfc samtygier-stfc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and passes tests.

@samtygier-stfc samtygier-stfc added this pull request to the merge queue Jun 24, 2024
Merged via the queue into main with commit 7af6d74 Jun 24, 2024
8 checks passed
@samtygier-stfc samtygier-stfc deleted the 2213-spectrum-viewer-stack-units-tests branch June 24, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Quality: Testing Release essential Essential to the release - showstoppers. If not done the release might be delayed
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants