Esempio n. 1
0
 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())
Esempio n. 2
0
 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')
Esempio n. 3
0
 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())
Esempio n. 4
0
 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")
Esempio n. 5
0
    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)
Esempio n. 6
0
    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)
Esempio n. 7
0
 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()))
Esempio n. 8
0
 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()))