Skip to content

Commit 79f94c8

Browse files
author
Xin Dong
committed
Added a unit test for a re-producable update error.
1 parent 6b5e0f2 commit 79f94c8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/correctness/smoke/test_update.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
from collections import OrderedDict
2525
import pytest
2626

27+
@pytest.mark.xfail
28+
def test_update_array_containing_none_value(fixture_collection):
29+
collection = fixture_collection
30+
31+
collection.insert({'A': [1, None]})
32+
33+
docCount = collection.find( {'A': {'$in': [ None]}}).count()
34+
assert docCount == 1, "Expect 1 documents before the update but got {}".format(docCount)
35+
36+
collection.update({'A': {'$size': 2}} , OrderedDict([('$pop', {'A': -1})]))
37+
38+
docCount = collection.find( {'A': {'$in': [ None]}}).count()
39+
assert docCount == 1, "Expect 1 documents after the update but got {}".format(docCount)
40+
2741
def test_addToSet_with_none_value(fixture_collection):
2842
collection = fixture_collection
2943

0 commit comments

Comments
 (0)