Skip to content

Commit d850319

Browse files
author
Xin Dong
committed
Resolve review comments.
1 parent 27e7a47 commit d850319

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

test/correctness/document-correctness.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,20 @@ def check_query(query, collection1, collection2, projection=None, sort=None, lim
218218

219219

220220
def test_update(collection1, collection2, verbose=False):
221-
okay = True
222-
skip_current_iteration = False
223221
for i in range(1, 10):
224222
exceptionOne = None
225223
exceptionTwo = None
226224
update = gen.random_update(collection1)
227225

228-
util.trace('error', '\n========== Update No.', i, '==========')
229-
util.trace('error', 'Query:', update['query'])
230-
util.trace('error', 'Update:', str(update['update']))
231-
util.trace('error', 'Number results from collection: ', gen.count_query_results(
226+
util.trace('debug', '\n========== Update No.', i, '==========')
227+
util.trace('debug', 'Query:', update['query'])
228+
util.trace('debug', 'Update:', str(update['update']))
229+
util.trace('debug', 'Number results from collection: ', gen.count_query_results(
232230
collection1, update['query']))
233231
for item in collection1.find(update['query']):
234-
util.trace('error', 'Find Result1:', item)
232+
util.trace('debug', 'Find Result1:', item)
235233
for item in collection2.find(update['query']):
236-
util.trace('error', 'Find Result2:', item)
234+
util.trace('debug', 'Find Result2:', item)
237235

238236
try:
239237
if verbose:
@@ -265,21 +263,19 @@ def test_update(collection1, collection2, verbose=False):
265263
# or (exceptionOne is not None and exceptionTwo is not None and exceptionOne.code == exceptionTwo.code)):
266264
# TODO re-enable the exact error check.
267265
# TODO re-enable consistency check when failure happened
268-
skip_current_iteration = True
269-
return (True, skip_current_iteration)
266+
return (True, True)
270267
else:
271268
print 'Unmatched result: '
272269
print type(exceptionOne), ': ', str(exceptionOne)
273270
print type(exceptionTwo), ': ', str(exceptionTwo)
274-
okay = False
275271
ignored_exception_check(exceptionOne)
276272
ignored_exception_check(exceptionTwo)
277-
return (okay, skip_current_iteration)
273+
return (False, False)
278274

279275
if not check_query(dict(), collection1, collection2):
280-
return (False, skip_current_iteration)
276+
return (False, False)
281277

282-
return (okay, skip_current_iteration)
278+
return (True, False)
283279

284280

285281
class IgnoredException(Exception):

test/correctness/mongo_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,10 @@ def insert(self, input):
529529
oldData = deepcopy(self.data)
530530
try:
531531
if isinstance(input, OrderedDict):
532-
self._insert(sorte_id_field(input))
532+
self._insert(sort_id_field(input))
533533
elif isinstance(input, list):
534534
all_ids = set()
535-
input = map(sorte_id_field, input)
535+
input = map(sort_id_field, input)
536536
for i in input:
537537
if '_id' in i:
538538
if not self.options.object_field_order_matters and isinstance(i['_id'], HashableOrderedDict):

test/correctness/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def mongo_sort_list_by_fields_list(array, field_name_list):
407407
# print 'field_name_map:', field_name_map
408408
return mongo_sort_list_by_fields(array, field_name_map)
409409

410-
def sorte_id_field(doc):
410+
def sort_id_field(doc):
411411
if '_id' in doc.keys() and isinstance(doc['_id'], dict):
412412
od = HashableOrderedDict()
413413
for k,v in sorted(doc['_id'].items(), key=lambda kv: kv[0]):

0 commit comments

Comments
 (0)