Skip to content

Fix ureg.parse_units("km",case_sensitive=False) returns randomly kilomolar or kilometer#2253

Open
Vitto1994 wants to merge 2 commits intohgrecco:masterfrom
Vitto1994:master
Open

Fix ureg.parse_units("km",case_sensitive=False) returns randomly kilomolar or kilometer#2253
Vitto1994 wants to merge 2 commits intohgrecco:masterfrom
Vitto1994:master

Conversation

@Vitto1994
Copy link

The function ureg.parse_units(‘km’, case_sensitive=False) returns both kilometres and kilomoles randomly when case_sensitive is False.
The _yield_unit_triplets function first perform a case-sensitive search in any case, then performs a final case-insensitive search only if the input parameter ‘CaseSensitive’ is False and the first search yielded no results.
This way the a case-sensitive result would be always prefered than a case-unsensitive one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ureg.parse_units("km",case_sensitive=False) returns randomly kilomolar or kilometer

1 participant