コード例 #1
0
ファイル: field_list.py プロジェクト: haudoing/mongoengine
 def test_reset(self):
     q = QueryFieldList(always_include=['x', 'y'])
     q += QueryFieldList(fields=['a', 'b', 'x'], value=QueryFieldList.EXCLUDE)
     q += QueryFieldList(fields=['b', 'c'], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {'x': True, 'y': True, 'c': True})
     q.reset()
     self.assertFalse(q)
     q += QueryFieldList(fields=['b', 'c'], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {'x': True, 'y': True, 'b': True, 'c': True})
コード例 #2
0
 def test_reset(self):
     q = QueryFieldList(always_include=['x', 'y'])
     q += QueryFieldList(fields=['a', 'b', 'x'], value=QueryFieldList.EXCLUDE)
     q += QueryFieldList(fields=['b', 'c'], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {'x': 1, 'y': 1, 'c': 1})
     q.reset()
     self.assertFalse(q)
     q += QueryFieldList(fields=['b', 'c'], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {'x': 1, 'y': 1, 'b': 1, 'c': 1})
コード例 #3
0
ファイル: field_list.py プロジェクト: MongoEngine/mongoengine
 def test_reset(self):
     q = QueryFieldList(always_include=["x", "y"])
     q += QueryFieldList(fields=["a", "b", "x"], value=QueryFieldList.EXCLUDE)
     q += QueryFieldList(fields=["b", "c"], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {"x": 1, "y": 1, "c": 1})
     q.reset()
     self.assertFalse(q)
     q += QueryFieldList(fields=["b", "c"], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {"x": 1, "y": 1, "b": 1, "c": 1})
コード例 #4
0
 def test_reset(self):
     q = QueryFieldList(always_include=["x", "y"])
     q += QueryFieldList(fields=["a", "b", "x"],
                         value=QueryFieldList.EXCLUDE)
     q += QueryFieldList(fields=["b", "c"], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {"x": 1, "y": 1, "c": 1})
     q.reset()
     self.assertFalse(q)
     q += QueryFieldList(fields=["b", "c"], value=QueryFieldList.ONLY)
     self.assertEqual(q.as_dict(), {"x": 1, "y": 1, "b": 1, "c": 1})
コード例 #5
0
ファイル: test_field_list.py プロジェクト: yeexy/mongoengine
 def test_reset(self):
     q = QueryFieldList(always_include=["x", "y"])
     q += QueryFieldList(fields=["a", "b", "x"],
                         value=QueryFieldList.EXCLUDE)
     q += QueryFieldList(fields=["b", "c"], value=QueryFieldList.ONLY)
     assert q.as_dict() == {"x": 1, "y": 1, "c": 1}
     q.reset()
     assert not q
     q += QueryFieldList(fields=["b", "c"], value=QueryFieldList.ONLY)
     assert q.as_dict() == {"x": 1, "y": 1, "b": 1, "c": 1}