def test_empty(self):
"""
Ensure that filter() works when it results in an empty QuerySet.
"""
# Filter to nothing.
with self.assertNumQueries(0):
qss = self.all.exclude(author__in=[self.alice, self.bob])
self.assertEqual(qss.count(), 0)
self.assertIsInstance(qss, QuerySetSequence)
# This should not throw an exception.
data = list(qss)
self.assertEqual(len(data), 0)
test_querysetsequence.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录