-
Notifications
You must be signed in to change notification settings - Fork 444
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
Fix parsing pofile with obsoletes #452
Fix parsing pofile with obsoletes #452
Conversation
Current coverage is 90.14% (diff: 97.43%)@@ master #452 diff @@
==========================================
Files 24 24
Lines 3960 3979 +19
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 3569 3587 +18
- Misses 391 392 +1
Partials 0 0
|
@@ -79,7 +79,7 @@ def test_read_multiline(self): | |||
message.id) | |||
|
|||
def test_fuzzy_header(self): | |||
buf = StringIO(r'''\ | |||
buf = StringIO(r''' |
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.
Out of curiosity -- is the parser still able to read files that start with a newline, i.e. is this just cleanup? :)
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.
So the combination of r and triple quotes means that you can't escape new lines using "\". The original actually tested the string:
\
# Translations template for AReallyReallyLongNameForAProject.
...
My version:
# Translations template for AReallyReallyLongNameForAProject.
...
So in fact the test is now testing handling files which start with a newline. It looks like the original author intended there to be no blank line at the start of the file, but introduced an invalid character instead. The parser now prints a warning for lines it doesn't understand, so I removed the character to prevent that warning getting printed during unit tests.
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.
Fair enough! Thank you for the explanation.
Could you fold the Python 2.6 changes into the relevant earlier commits? Otherwise this looks nice :) |
Fixes the handling of the unit before the obsolete unit. Previously it would mark the unit before an obsolete unit as obsolete also. Some refactoring: * the transition between finishing one unit and starting the next is clearer * separate the processing of keywords and continuation lines * combine the reset and initialisation code * Make the handling of strings consistent. * Add some nascent error handling, removed some errors in test inputs
bfbc48d
to
7dfe6f9
Compare
Fixes the handling of the unit before the obsolete unit. Previously it would mark the unit before an obsolete unit as obsolete also.
Fixes multi-line msgctxt statements. Previously it would just take the first line.
Some refactoring: