Commit e705eb6
fix: Handle multiple spaces in Raw Data line for BMG MARS parser (#1243)
## Summary
BMG PHERAstar CSV exports can write the `Raw Data` header with more than
one space before the filter parenthesis (e.g. `Raw Data (450)` with two
spaces). The parser's regexes required exactly one literal space, so
parsing failed with:
```
AllotropeConversionError: Raw Data line not found in input file.
```
This relaxes the whitespace to `\s+` in the search regex and all four
`FILTER_FORMATS` patterns in `bmg_mars_structure.py`.
## Changes
- `bmg_mars_structure.py`: `Raw Data \(` → `Raw Data\s+\(` in the search
regex and all filter format patterns.
- Added regression test data: `PHERAstar output file.CSV` (a real
double-space export) and its generated expected `.json`.
## Testing
- All 8 `bmg_mars` tests pass.
- `hatch run lint` (ruff, black, mypy) clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 42970b7 commit e705eb6
3 files changed
Lines changed: 3980 additions & 5 deletions
File tree
- src/allotropy/parsers/bmg_mars
- tests/parsers/bmg_mars/testdata
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
| 86 | + | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments