We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If you try and create a Quantity with a hyphen in the unit name, you get a very odd exception.
Quantity
In [1]: import pint In [2]: pint.Quantity(value=1, units="kilo-watt") --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[7], line 1 ----> 1 pint.Quantity(value=1, units="kilo-watt") File ~/path/to/.venv/lib/python3.12/site-packages/pint/pint_eval.py:383, in EvalTreeNode.evaluate(self, define_op, bin_op, un_op) 380 if op_text not in bin_op: 381 raise DefinitionSyntaxError(f"missing binary operator '{op_text}'") --> 383 return bin_op[op_text]( 384 self.left.evaluate(define_op, bin_op, un_op), 385 self.right.evaluate(define_op, bin_op, un_op), 386 ) 387 elif self.operator: 388 assert isinstance(self.left, EvalTreeNode), "self.left not EvalTreeNode (4)" TypeError: unsupported operand type(s) for -: 'ParserHelper' and 'ParserHelper'
I would expect this to raise the normal error:
UndefinedUnitError: 'megaflop' is not defined in the unit registry
The text was updated successfully, but these errors were encountered:
No branches or pull requests
If you try and create a
Quantity
with a hyphen in the unit name, you get a very odd exception.I would expect this to raise the normal error:
The text was updated successfully, but these errors were encountered: