Closed gabe-sherman closed 1 month ago
I updated the error message and added a test. Let me know if there's any other changes that should be made!
Thanks! I'll take a look later today or tomorrow (ping me in case I forget)
Sorry for the delay, it's been a busy couple of days. I just added a couple more test cases!
Made those extra changes. Thanks for sticking with me as I work through everything!
Made those extra changes. Thanks for sticking with me as I work through everything!
Thank you for working on the fix! It's looking good to me but I don't have commit rights in this repo so I'm pinging @akx :slightly_smiling_face:
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 91.31%. Comparing base (
f91754b
) to head (2d72d66
). Report is 5 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thank you! The test was a bit buggy, so I went ahead and fixed that – and also that we don't do (a tiny bit of) extra work if we'd end up raising an error next anyway.
Addresses https://github.com/python-babel/babel/issues/1134
Previously, the
add_message
function would try to access the PoFileParser object's translations list without any checks. However, when an invalid po file is provided, this can lead to an index out of range error.This PR adds a check to the
_finish_current_message
function and raises aninvalid_pofile
exception when the messages list is populated and translations is empty. This also adds a dummy translation to the translations list to avoid the index out of range error when aninvalid_pofile
exception is treated as a warning rather than raised.