Skip to content

Commit e2ffcb2

Browse files
author
Xin Dong
committed
Fixed a bug in MM where it wrongly serialize empty array to be empty string, where it should be '[]'
1 parent bd617bc commit e2ffcb2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/correctness/mongo_model.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,11 @@ def validate_and_build_entry(self, documents, first_build=False):
12761276
check_none_at_all=True,
12771277
check_none_next=True,
12781278
debug=False)
1279-
entry = entry + reduce((lambda acc, x: acc + x), map((lambda x: str(x)), _values), "")
1279+
if len(_values) == 0:
1280+
# empty array
1281+
entry = entry + '[]'
1282+
else:
1283+
entry = entry + reduce((lambda acc, x: acc + x), map((lambda x: str(x)), _values), "")
12801284
if entry in seen:
12811285
# print "[{}] in {} ? {}".format(entry, seen, entry in seen)
12821286
# print "Violating keys " + str(key)

0 commit comments

Comments
 (0)