-
Notifications
You must be signed in to change notification settings - Fork 10
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
BUG: Fix parse_spec #103
BUG: Fix parse_spec #103
Conversation
TST: Pin synphot too in older versions job.
stsynphot/spparser.py
Outdated
for arg in args: | ||
try: | ||
names.append(arg.meta['expr']) | ||
except Exception: |
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.
Wouldn't be safer to look for specific types of Exception
instead of the generic base type? In the way it's here, the caller wouldn't ever be able to see errors that may happen inside the try-except block. One case that we can easily spot is a KeyError
from the meta['expr']
construct.
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.
Related to my comment on generic Exception handling, it would be good to add a couple of test cases that actually result in an exception being raised by the parser. That way we would ensure that the code is handling things in the desired way.
@ibusko , good point on the blind exception handling. I replaced it with a more explicit |
'rn(crcalspec$bd_75d325_stis_002.fits, band(u), 9.5, vegamag) * ' | ||
'band(fos, blue, 4.3, g160l)') | ||
# NOTE: No expr for this combo. | ||
_single_functioncall(sp1, SourceSpectrum, None, '') |
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.
@ibusko , as discussed in spacetelescope/synphot_refactor#237, this is the only string among those being tested that does not have a "name."
Re: extra tests -- I cannot think of any use case that would result in |
Fix #102
Address part of spacetelescope/synphot_refactor#237
TODO
parse_spec
results and compare to doing it the non-IRAF way.