mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
added tests for common.calculate_math_string
This commit is contained in:
parent
24b20d7668
commit
6b1f242d25
2 changed files with 15 additions and 0 deletions
|
@ -3224,6 +3224,8 @@ def calculate_math_string(expr):
|
|||
raise SyntaxError(node)
|
||||
|
||||
try:
|
||||
if '#' in expr:
|
||||
raise SyntaxError('no comments allowed')
|
||||
return execute_ast(ast.parse(expr, mode='eval').body)
|
||||
except SyntaxError as e:
|
||||
raise SyntaxError("could not parse expression '{expr}', "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue