def test_delete_queryset(self): d = self.test_doc(a='a') yield from d.save() collection = self.test_doc._get_collection() qs = QuerySet(self.test_doc, collection) yield from qs.delete() docs = yield from qs.to_list() self.assertEqual(len(docs), 0)
def test_to_list(self): futures = [] for i in range(4): d = self.test_doc(a=str(i)) futures.append(d.save()) yield from asyncio.gather(*futures) collection = self.test_doc._collection qs = QuerySet(self.test_doc, collection) qs = qs.filter(a__in=['1', '2']) docs = yield from qs.to_list() self.assertEqual(len(docs), 2) self.assertTrue(isinstance(docs[0], self.test_doc))