Improve DDB expressions support3: AST Validation
Part of structured approach for UpdateExpressions: 1) Expression gets parsed into a tokenlist (tokenized) 2) Tokenlist get transformed to expression tree (AST) 3) The AST gets validated (full semantic correctness) -> this commit 4) AST gets processed to perform the update This commit uses the AST to perform validation. Validation makes sure the nodes encounterd have valid values and they will also resolve values for references that refer to item state or values passed into the expression.
This commit is contained in:
parent
9ed613e197
commit
fc4d88401d
9 changed files with 1127 additions and 11 deletions
|
|
@ -393,3 +393,13 @@ def test_update_expression_parsing_is_not_keyword_aware():
|
|||
except InvalidTokenException as te:
|
||||
assert te.token == "1"
|
||||
assert te.near == "VALUE 1"
|
||||
|
||||
|
||||
def test_expression_if_not_exists_is_not_valid_in_remove_statement():
|
||||
set_action = "REMOVE if_not_exists(a,b)"
|
||||
try:
|
||||
UpdateExpressionParser.make(set_action)
|
||||
assert False, "Exception not raised correctly"
|
||||
except InvalidTokenException as te:
|
||||
assert te.token == "("
|
||||
assert te.near == "if_not_exists(a"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue