def test_simplify(self):
"""
Ensure that filter() properly filters the children QuerySets and
simplifies to a single child QuerySet when all others become empty.
"""
# Filter to just Alice's work.
with self.assertNumQueries(0):
alice_qss = self.all.exclude(author=self.bob)
self.assertEqual(alice_qss.count(), 2)
# TODO
# self.assertIsNone(alice_qss._result_cache)
# Since we've now filtered down to a single QuerySet, we shouldn't be a
# QuerySetSequence any longer.
self.assertIsInstance(alice_qss, QuerySet)
test_querysetsequence.py 文件源码
python
阅读 18
收藏 0
点赞 0
评论 0
评论列表
文章目录