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
Add unit tests for ISIS_Powder common routines #19163
Add unit tests for ISIS_Powder common routines #19163
Conversation
…EM' into 19113_add_unit_tests_ISIS_Powder_common Re #19113 Merge changes from GEM migration
@@ -65,9 +65,9 @@ def update_attributes(self, advanced_config=None, basic_config=None, kwargs=None | |||
self._parse_attributes(self._adv_config_dict, suppress_warnings=suppress_warnings) | |||
if advanced_config or basic_config: | |||
self._parse_attributes(self._basic_conf_dict, | |||
suppress_warnings=(not bool(basic_config or suppress_warnings))) | |||
suppress_warnings=(not bool(basic_config) or suppress_warnings)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More of a query than a note, do we have to cast implicitly to bool
? I think it's done automatically when you put the not
in front, i.e. there shouldn't be a difference between not bool(basic_config)
and just not basic_config
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point Python does this implicitly I'll change that in the current branch I'm working on (to reduce the number of merge conflict in the future)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump to remove bool, unit tests passed
From a brief look changes look good, all the unit tests pass, I'll have a look again after #19112 is merged and mark for ship then |
if advanced_config or basic_config or kwargs: | ||
self._parse_attributes(self._kwargs, suppress_warnings=(not bool(kwargs or suppress_warnings))) | ||
self._parse_attributes(self._kwargs, suppress_warnings=(not bool(kwargs)) or suppress_warnings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not bool(kwargs)) or suppress_warnings)
is the 2nd bracket after kwargs a mistake?
@@ -65,9 +65,9 @@ def update_attributes(self, advanced_config=None, basic_config=None, kwargs=None | |||
self._parse_attributes(self._adv_config_dict, suppress_warnings=suppress_warnings) | |||
if advanced_config or basic_config: | |||
self._parse_attributes(self._basic_conf_dict, | |||
suppress_warnings=(not bool(basic_config or suppress_warnings))) | |||
suppress_warnings=(not bool(basic_config) or suppress_warnings)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bump to remove bool, unit tests passed
"This should be a range of runs in this cycle in the mapping file." | ||
" Please check your indentation if this should be within a cycle.") | ||
"This should be a range of runs in the mapping file." | ||
" Please check your indentation if the syntax looks correct.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check your indentation if the syntax looks correct.
consider rephrasing to something like
Please check your indentation and make sure that the syntax is correct.
@@ -156,7 +157,10 @@ def get_first_run_number(run_number_string): | |||
:return: The first run for the user input of runs | |||
""" | |||
run_numbers = generate_run_numbers(run_number_string=run_number_string) | |||
return run_numbers[0] | |||
if isinstance(run_numbers, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like generate_run_numbers
always returns a list, with single run number, or a range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also in get_monitor_ws
here, I think you could use get_first_run_number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats correct - it means the caller doesn't have to figure out types on their end (e.g. can just use a for in loop or [0])
Good spot 👍
Use |
when OSX build lands on a node which has yaml installed |
Must not be merged before #19112 - I would recommend waiting for that PR before taking this one so you can get an accurate diffDescription of work.
This PR adds unit tests for the common functions in the ISIS_Powder scripts
To test:
Check that unit tests pass
Code review
Fixes #19113 .
Does not need to be in the release notes.
Reviewer
Please comment on the following (full description):
Code Review
Functional Tests
Do changes function as described? Add comments below that describe the tests performed?
How do the changes handle unexpected situations, e.g. bad input?
Has the relevant documentation been added/updated?
Is user-facing documentation written in a user-friendly manner?
Has developer documentation been updated if required?
Does everything look good? Comment with the ship it emoji but don't merge. A member of
@mantidproject/gatekeepers
will take care of it.