Whole file
ministryofjustice/bai2
The author described this change as “fix support for BAI2 files with trailing whitespaces and blank lines”. It counts as a record because the checks below fail on the code as it stood at ce7d84a7d and pass on 544dc7e9f, with nothing else changed between the two runs.
Projectministryofjustice/bai2
Fix saved2023-11-30
Sharing licenceMIT · LICENSE.txt
Change size+7 −1
What the code was meant to do, written into the code itself as a save note
fix support for BAI2 files with trailing whitespaces and blank lines
The change
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | 12 | def parse_from_string(s, **kwargs): | |
| 13 | - | return parse_from_lines(s.splitlines(), **kwargs) | |
| 13 | + | lines = [ | |
| 14 | + | line.strip() | |
| 15 | + | for line in s.splitlines() | |
| 16 | + | if line.strip() | |
| 17 | + | ] | |
| 18 | + | ||
| 19 | + | return parse_from_lines(lines, **kwargs) | |
| 14 | 20 | ||
| 15 | 21 | ||
| 16 | 22 | def parse_from_file(f, **kwargs): |
The check that tells the two apart
fail→pass·tests/test_bai2.py::ParseTestCase::test_parse_files_with_blank_lines
fail→pass·tests/test_bai2.py::ParseTestCase::test_parse_files_with_trailing_whitespaces
Check file tests/test_bai2.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itce7d84a7d896baacde1dcd18b7b6efce7026cd2b
Broken version dated2023-11-16
Modulebai2.bai2
Units changedparse_from_string
Fingerprinta9f8f2a422ee456e
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.