fix: normalize micro codepoint to U+00B5 in Units - #145
Draft
bluetoothbot wants to merge 1 commit into
Draft
Conversation
TIME_MICROSECONDS and CONCENTRATION_MICROGRAMS_PER_CUBIC_FOOT used the Greek small letter mu (U+03BC) while every other micro unit — and Home Assistant — uses the micro sign (U+00B5). The two glyphs render identically but compare unequal, so string equality against HA's unit constants silently failed for these two members. Closes Bluetooth-Devices#143.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
=======================================
Coverage 94.37% 94.37%
=======================================
Files 12 12
Lines 480 480
Branches 5 5
=======================================
Hits 453 453
Misses 26 26
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Normalize the two "micro" units that used the Greek letter mu (U+03BC) to the micro sign (U+00B5).
Why:
TIME_MICROSECONDS(µs) andCONCENTRATION_MICROGRAMS_PER_CUBIC_FOOT(µg/ft³) were declared with U+03BC, while every other micro unit in the enum — and the Home Assistant constants this library mirrors — use U+00B5. The glyphs render identically but compare unequal, so string equality against HA's unit constants silently failed for exactly these two members. Closes #143.How: Two-character value change in
units.py; member names and all other values are untouched. Addedtests/test_units.pypinning every micro unit to U+00B5 so the inconsistency can't recur.Testing: New regression tests fail on
mainand pass on this branch; full suite (10 tests) green under Python 3.12, ruff clean.Quality Report
Changes: 2 files changed, 27 insertions(+), 2 deletions(-)
Code scan: clean
Tests: passed (10 passed)
Branch hygiene: clean
Generated by Kōan