Commit adeb3a4
fix: Support EnVision calculated formulas without a name prefix (#1246)
## Summary
A PerkinElmer EnVision 384-well absorbance export (`OD450`) failed to
parse:
```
AllotropeConversionError: Unable to find expected formula name for calculated results section.
```
The calculated plate's `Formula` is a plain description with no `name =`
prefix:
```
Calc 1: OD450 direct absorbance value at 450 nm
```
`CalculatedPlateInfo.create` extracted the name with `^([^=]*)=`, which
assumes the standard form `Calc N: <name> = <expression>` and raised
when no `=` was present.
## Fix
When the formula has no `=`, fall back to using the whole formula string
as the calculated data name. Standard formulas are unaffected.
## Changes
- `perkin_elmer_envision_structure.py`: make the formula-name regex
optional with a whole-string fallback.
- Reworked `test_create_calculated_plate_info_with_invalid_formula` →
`test_create_calculated_plate_info_with_formula_without_name` to assert
the fallback.
- Edited the formula in the existing
`PE_Envision_fluorescence_example01.csv` to the no-`=` form (and
regenerated its expected JSON) to exercise the fallback end-to-end.
Other example files retain the standard `name = expression` form, so
both branches stay covered.
## Testing
- All 24 `perkin_elmer_envision` 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 1b963ec commit adeb3a4
4 files changed
Lines changed: 118 additions & 109 deletions
File tree
- src/allotropy/parsers/perkin_elmer_envision
- tests/parsers/perkin_elmer_envision
- testdata
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
| |||
Lines changed: 12 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
349 | 351 | | |
350 | 352 | | |
351 | 353 | | |
352 | 354 | | |
353 | 355 | | |
354 | | - | |
| 356 | + | |
355 | 357 | | |
356 | 358 | | |
357 | 359 | | |
358 | 360 | | |
359 | | - | |
360 | | - | |
361 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
362 | 369 | | |
363 | 370 | | |
364 | 371 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
| 122 | + | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
0 commit comments