def test_qs_generator_inequality(self): """ Each QuerySet-returning method's return value is unique. """ qs = QuerySetMock(None, 1, 2, 3) self.assertNotEquals(qs.all(), qs.filter()) self.assertNotEquals(qs.filter(), qs.order_by())
def test_chaining_calls_works(self): """ Chained calls to QS-returning methods should return new QuerySetMocks. """ qs = QuerySetMock(None, 1, 2, 3) qs.all().filter(filter_arg='dummy') qs.filter(filter_arg='dummy').order_by('-date')
def test_chaining_calls_works(self): """ Chained calls to QS-returning methods should return new QuerySetMocks. """ qs = QuerySetMock(None, 1, 2, 3) qs.all().filter(filter_arg="dummy") qs.filter(filter_arg="dummy").order_by("-date")
def test_chained_calls_return_new_querysetmocks(self): qs = QuerySetMock(None, 1, 2, 3) qs_all = qs.all() qs_filter = qs.filter() qs_all_filter = qs.filter().all() self.assertIsNot(qs_all, qs_filter) self.assertIsNot(qs_filter, qs_all_filter)
def test_qs_yield_equality(self): """ The generators may not be the same, but they do produce the same output. """ qs = QuerySetMock(None, 1, 2, 3) self.assertEquals(list(qs.all()), list(qs.filter()))