Allow spaces to if_not_exists

This commit is contained in:
Kosei Kitahara 2018-10-11 18:21:53 +09:00
parent dfa7935e13
commit 2c15d71c2c
No known key found for this signature in database
GPG Key ID: D18883191F02241B
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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
}