Esempio n. 1
0
    def test_filter_with_multiple_args(self):
        """Testing LocalDataQuerySet.filter with multiple arguments"""
        obj1 = Mock()
        obj1.a = 1
        obj1.b = 2

        obj2 = Mock()
        obj2.a = 1
        obj2.b = 20

        obj3 = Mock()
        obj3.a = 2
        obj3.b = 20

        queryset = LocalDataQuerySet([obj1, obj2, obj3])
        queryset = queryset.filter(a=1, b=20)

        self.assertEqual(len(queryset), 1)
        self.assertEqual(queryset[0], obj2)
Esempio n. 2
0
    def test_filter_with_multiple_args(self):
        """Testing LocalDataQuerySet.filter with multiple arguments"""
        obj1 = Mock()
        obj1.a = 1
        obj1.b = 2

        obj2 = Mock()
        obj2.a = 1
        obj2.b = 20

        obj3 = Mock()
        obj3.a = 2
        obj3.b = 20

        queryset = LocalDataQuerySet([obj1, obj2, obj3])
        queryset = queryset.filter(a=1, b=20)

        self.assertEqual(len(queryset), 1)
        self.assertEqual(queryset[0], obj2)
Esempio n. 3
0
    def test_filter(self):
        """Testing LocalDataQuerySet.filter"""
        obj1 = Mock()
        obj1.a = 1
        obj1.b = 2

        obj2 = Mock()
        obj2.a = 10
        obj2.b = 20

        obj3 = Mock()
        obj3.a = 1
        obj3.b = 40

        queryset = LocalDataQuerySet([obj1, obj2, obj3])
        queryset = queryset.filter(a=1)

        self.assertEqual(len(queryset), 2)
        self.assertEqual(list(queryset), [obj1, obj3])
Esempio n. 4
0
    def test_filter(self):
        """Testing LocalDataQuerySet.filter"""
        obj1 = Mock()
        obj1.a = 1
        obj1.b = 2

        obj2 = Mock()
        obj2.a = 10
        obj2.b = 20

        obj3 = Mock()
        obj3.a = 1
        obj3.b = 40

        queryset = LocalDataQuerySet([obj1, obj2, obj3])
        queryset = queryset.filter(a=1)

        self.assertEqual(len(queryset), 2)
        self.assertEqual(list(queryset), [obj1, obj3])