Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correcting an issue where prefixes weren't round-tripping correctly. #60

Merged
merged 2 commits into from
Oct 22, 2023

Conversation

chrisguidry
Copy link
Owner

This was a persistent issue with the test suite, randomly failing a hypothesis
example occasionally. I had some confusion in the string formatting for
prefixed units, where the precedence would get out of whack. For example, when
formatting (Kilo*Meter)**2, we'd format that as Mm² because a square
kilometer is a million square meters; however the parsing would treat that as
if it were a (Mega*Meter)**2. There were also a few more issues and a test
flake in MathML formatting.

This was a persistent issue with the test suite, randomly failing a hypothesis
example occasionally.  I had some confusion in the string formatting for
prefixed units, where the precedence would get out of whack.  For example, when
formatting `(Kilo*Meter)**2`, we'd format that as `Mm²` because a square
kilometer is a million square meters; however the parsing would treat that as
if it were a `(Mega*Meter)**2`.  There were also a few more issues and a test
flake in MathML formatting.
@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Merging #60 (58cdba5) into main (11d5566) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main       #60   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           82        82           
  Lines         4344      4377   +33     
  Branches       655       664    +9     
=========================================
+ Hits          4344      4377   +33     
Flag Coverage Δ
python-3.10 100.00% <100.00%> (ø)
python-3.11 100.00% <100.00%> (ø)
python-3.8 100.00% <100.00%> (ø)
python-3.9 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/measured/formatting.py 100.00% <100.00%> (ø)
tests/test_formatting.py 100.00% <100.00%> (ø)
tests/test_parsing.py 100.00% <100.00%> (ø)

@chrisguidry chrisguidry merged commit ac5afdd into main Oct 22, 2023
8 checks passed
@chrisguidry chrisguidry deleted the prefix-parsing branch October 22, 2023 15:35
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.

1 participant