-
Notifications
You must be signed in to change notification settings - Fork 453
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
[REGR} formatter does not handle negative powers in numerator correctly #1983
Comments
I've added the first line (commented here) to avoid this error message: 10 # >>> ureg.formatter._registry = ureg
11 q = ureg.Quantity(2,"m")
---> 12 str(q)
13 '2.3e-06 ups!'
File F:\A\repos\pint\pint\facets\plain\quantity.py:270, in PlainQuantity.__str__(self)
269 def __str__(self) -> str:
--> 270 return self._REGISTRY.formatter.format_quantity(self)
File F:\A\repos\pint\pint\delegates\formatter\plain.py:129, in DefaultFormatter.format_quantity(self, quantity, qspec, sort_func, **babel_kwds)
122 """Format a quantity (magnitude and unit) into string
123 given a string formatting specification and locale related arguments.
124 """
126 registry = self._registry
128 mspec, uspec = split_format(
--> 129 qspec, registry.formatter.default_format, registry.separate_format_defaults
130 )
132 joint_fstring = "{} {}"
133 return join_mu(
134 joint_fstring,
135 self.format_magnitude(quantity.magnitude, mspec, **babel_kwds),
136 self.format_unit(quantity.unit_items(), uspec, sort_func, **babel_kwds),
137 )
AttributeError: 'NoneType' object has no attribute 'formatter' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The doctests were failing. I've changed them to get them working again:
This feels uncessarily clunky
The text was updated successfully, but these errors were encountered: