test_querysetsequence.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:django-querysetsequence 作者: percipient 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号