From cf157287e707117447ccb637d8ffbf642eaad240 Mon Sep 17 00:00:00 2001 From: Kosei Kitahara Date: Fri, 12 Oct 2018 16:08:05 +0900 Subject: [PATCH] Fix wrong type if exists --- moto/dynamodb2/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/moto/dynamodb2/models.py b/moto/dynamodb2/models.py index b327c7a4b..02b2933f2 100644 --- a/moto/dynamodb2/models.py +++ b/moto/dynamodb2/models.py @@ -162,12 +162,13 @@ class Item(BaseModel): # If it already exists, get its value so we dont overwrite it if path in self.attrs: - value = self.attrs[path].cast_value + value = self.attrs[path] - if value in expression_attribute_values: - value = DynamoType(expression_attribute_values[value]) - else: - value = DynamoType({"S": value}) + if type(value) != DynamoType: + if value in expression_attribute_values: + value = DynamoType(expression_attribute_values[value]) + else: + value = DynamoType({"S": value}) if '.' not in key: self.attrs[key] = value