diff options
author | Benjamin W. Portner <benjamin.portner@bauhaus-luftfahrt.net> | 2023-01-19 19:28:05 +0100 |
---|---|---|
committer | Benjamin W. Portner <benjamin.portner@bauhaus-luftfahrt.net> | 2023-01-19 19:28:05 +0100 |
commit | eecd0d97998bc34200b8d073ecbbad9361c04ecf (patch) | |
tree | a54e15eabb1230f85bad2d015417823752ac8628 /pint/testsuite | |
parent | 05066e0e791f84ca03ed34643348b5348e2f5786 (diff) | |
download | pint-eecd0d97998bc34200b8d073ecbbad9361c04ecf.tar.gz |
modify string pre-processing such that multiplication operator is inserted before and after brackets, e.g. 2 (3 + 4) -> 2 * (3 + 4)
Diffstat (limited to 'pint/testsuite')
-rw-r--r-- | pint/testsuite/test_pint_eval.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/pint/testsuite/test_pint_eval.py b/pint/testsuite/test_pint_eval.py index d396929..b5b94f0 100644 --- a/pint/testsuite/test_pint_eval.py +++ b/pint/testsuite/test_pint_eval.py @@ -106,9 +106,9 @@ class TestPintEval: # implicit op ("3 4", "(3 * 4)"), # implicit op, then parentheses - ("3 (2 + 4)", "(3 (2 + 4))"), + ("3 (2 + 4)", "(3 * (2 + 4))"), # parentheses, then implicit - ("(3 ** 4 ) 5", "((3 ** 4) 5)"), + ("(3 ** 4 ) 5", "((3 ** 4) * 5)"), # implicit op, then exponentiation ("3 4 ** 5", "(3 * (4 ** 5))"), # implicit op, then addition @@ -116,7 +116,7 @@ class TestPintEval: # power followed by implicit ("3 ** 4 5", "((3 ** 4) * 5)"), # implicit with parentheses - ("3 (4 ** 5)", "(3 (4 ** 5))"), + ("3 (4 ** 5)", "(3 * (4 ** 5))"), # exponent with e ("3e-1", "3e-1"), # multiple units with exponents @@ -136,8 +136,8 @@ class TestPintEval: # units should behave like numbers, so we don't need a bunch of extra tests for them # implicit op, then addition ("3 kg + 5", "((3 * kg) + 5)"), - ("(5 % 2) m", "((5 % 2) m)"), # mod operator - ("(5 // 2) m", "((5 // 2) m)"), # floordiv operator + ("(5 % 2) m", "((5 % 2) * m)"), # mod operator + ("(5 // 2) m", "((5 // 2) * m)"), # floordiv operator ), ) def test_preprocessed_eval_tree(self, input_text, parsed): |