Allow spaces to if_not_exists
This commit is contained in:
parent
dfa7935e13
commit
2c15d71c2c
@ -154,7 +154,7 @@ class Item(BaseModel):
|
||||
# If not exists, changes value to a default if needed, else its the same as it was
|
||||
if value.startswith('if_not_exists'):
|
||||
# Function signature
|
||||
match = re.match(r'.*if_not_exists\((?P<path>.+),\s*(?P<default>.+)\).*', value)
|
||||
match = re.match(r'.*if_not_exists\s*\((?P<path>.+),\s*(?P<default>.+)\).*', value)
|
||||
if not match:
|
||||
raise TypeError
|
||||
|
||||
|
@ -1220,7 +1220,8 @@ def test_update_if_not_exists():
|
||||
'forum_name': 'the-key',
|
||||
'subject': '123'
|
||||
},
|
||||
UpdateExpression='SET created_at = if_not_exists(created_at, :created_at)',
|
||||
# if_not_exists without space
|
||||
UpdateExpression='SET created_at=if_not_exists(created_at,:created_at)',
|
||||
ExpressionAttributeValues={
|
||||
':created_at': 123
|
||||
}
|
||||
@ -1233,7 +1234,8 @@ def test_update_if_not_exists():
|
||||
'forum_name': 'the-key',
|
||||
'subject': '123'
|
||||
},
|
||||
UpdateExpression='SET created_at = if_not_exists(created_at, :created_at)',
|
||||
# if_not_exists with space
|
||||
UpdateExpression='SET created_at = if_not_exists (created_at, :created_at)',
|
||||
ExpressionAttributeValues={
|
||||
':created_at': 456
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user