Commit d57a1e7
fix(vis): only strip Quantity for plain (non-pint) format specs
The previous fix stripped magnitudes from every Quantity in leg_dat, but
the default-spec branch in WaveformBrowser.__init__ substitutes
'0.3gP~' for entries without an explicit format. Stripping there made
the format call ValueError out because '0.3gP~' is invalid for plain
floats.
Parse each legend format string and only strip Quantities whose spec
has no pint formatter character (~, P, H, L, C, D). Default '0.3gP~'
and explicit pint specs keep the Quantity; user-provided plain specs
like '0.1f' get the magnitude so pint's DeprecationWarning does not
fire.
Also add tests/test_units.py to lock in the application-registry
sharing contract (importing dspeed must not replace pint's app
registry, and consumer-created quantities must interoperate with
dspeed.units.unit_registry quantities).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 7f07406 commit d57a1e7
2 files changed
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
552 | 557 | | |
553 | 558 | | |
554 | | - | |
| 559 | + | |
555 | 560 | | |
556 | 561 | | |
557 | 562 | | |
| |||
| 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 | + | |
0 commit comments