Repository navigation
Add milli- prefix to Angstrom unit - #11788
Conversation
There was a problem hiding this comment.
Welcome to Astropy 👋 and congratulations on your first pull request! 🎉
A project member will respond to you as soon as possible; in the meantime, please have a look over the Checklist for Contributed Code and make sure you've addressed as many of the questions there as possible.
If you feel that this pull request has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail [email protected].
mhvk
left a comment
There was a problem hiding this comment.
Thanks, looks all good. I'll merge once all the tests have passed.
|
Shouldn't there be a test too? |
|
The automatic going through all units should be good enough. But I note there is a failure in the doctests, plus a real error because @byrdie - do you think you'll be able to fix this? If you feel it is too tricky, I can do it for you. |
|
I will give it a try and let you know if I have any issues.
|
|
This works in some unexpected way in that it enables
It might seem more logical then to define it as def_unit(['AA', 'Angstrom', 'angstrom'], ...but that would break e.g. the expected fits format outputs. prefixes=[(['m', 'milli'], ['milli', 'm'], 1.e-3)],You will also have to update the matches for test_units:test_suggestions to ('ångström', 'Angstrom, angstrom, mAngstrom or mangstrom') |
|
@dhomeier, thanks for explaining that, I had not yet figured out why that test was failing. |
As discussed in Issue astropy#11745.
mhvk
left a comment
There was a problem hiding this comment.
@byrdie - there was still a failure in a doctest (in which milliangstrom is now offered - correctly - as an alternative). I went ahead and pushed a change for that to your branch, also squashing your comments in the process. I hope that with this all the tests will pass, because the rest looks all OK. So, I'll approve and merge if tests indeed pass.
Thanks!
|
@mhvk this does raise some concerns that similar problems might pop up downstream if looking for the expected exception. But I don't really see a good alternative if we want to accept |
|
@mhvk, thanks for updating the doctest. I didn't know if I was supposed to update the .rst file directly or if there was a docstring in |
|
@byrdie - yes, I thought this was getting a bit beyond what a supposedly quick PR should do, especially as with those doctests it is often a bit trickier than thought. Anyway, tests pass now and @dhomeier also agrees this is all OK, so I'll merge. Thanks again, and of course other suggestions for making astropy just a little bit better are very welcome! |
|
p.s. @dhomeier - I agree that the |
|
Thanks @byrdie and congrats to completing the first PR into Astropy! |
Description
Added milli- prefix to Angstrom unit
Fixes #11745