

def test_queryset_is_lazy(self):
    with mock.patch('lifter.query.QuerySet._fetch_all') as fetch:
        qs = self.manager.all().filter((TestModel.order == 3))
        fetch.assert_not_called()
        self.assertFalse(qs._populated)
        self.assertEqual(qs._data, [])
    self.assertEqual(qs, [self.OBJECTS[1]])
    with mock.patch('lifter.query.QuerySet._fetch_all') as fetch:
        self.assertEqual(qs, [self.OBJECTS[1]])
        self.assertEqual(qs, [self.OBJECTS[1]])
        self.assertEqual(qs, [self.OBJECTS[1]])
        self.assertTrue(qs._populated)
        fetch.assert_not_called()

dataset/ETHPy150Open EliotBerriot/lifter/tests/test_explicit_query_engine.py TestQueries.test_queryset_is_lazy/original