Skip to content

Commit bfb3e56

Browse files
committed
handle ident without spaces
1 parent 6e0b61a commit bfb3e56

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

OMPython/OMTypedParser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ def convertTuple(t):
9393
def evaluateExpression(s, loc, toks):
9494
# Convert the tokens (ParseResults) into a string expression
9595
flat_list = [item for sublist in toks[0] for item in sublist]
96-
expr = " ".join(flat_list)
96+
expr = "".join(flat_list)
9797
try:
9898
# Evaluate the expression safely
9999
return eval(expr)
100-
except NameError:
100+
except Exception:
101101
return expr
102102

103103
# Number parsing (supports arithmetic expressions in dimensions) (e.g., {1 + 1, 1})

tests/test_ArrayDimension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_ArrayDimension(self):
3030
omc.sendExpression("getErrorString()")
3131

3232
result = omc.sendExpression("getComponents(A)")
33-
assert result[-1][-1] == ('y + 1', 10), f"array dimension does not match the expected value. Got: {result[-1][-1]}, Expected: {('y + 1', 10)}"
33+
assert result[-1][-1] == ('y+1', 10), f"array dimension does not match the expected value. Got: {result[-1][-1]}, Expected: {('y+1', 10)}"
3434

3535
omc.__del__()
3636
shutil.rmtree(tempdir, ignore_errors= True)

0 commit comments

Comments
 (0)