def test_prefetch(self): related = Related() related.prefetch('foo') self.assertEqual(related._prefetch, { 'foo' }) related.prefetch('bar') self.assertEqual(related._prefetch, { 'foo', 'bar' })
def test_prepare(self): related = Related() related.select('foo') related.prefetch('bar') queryset = related.prepare(mock_orm.QuerySet()) self.assertEqual(queryset._selected, { 'foo' }) self.assertEqual(queryset._prefetched, { 'bar' })