Esempio n. 1
0
    def test_can_check_nested_iterables(self):
        users = [
            {
                'name': 'Kurt',
                'tags': [
                    {
                        'name': 'nice'
                    },
                    {
                        'name': 'friendly'
                    },
                ]
            },
            {
                'name': 'Bill',
                'tags': [
                    {
                        'name': 'friendly'
                    },
                ]
            },
        ]
        manager = lifter.load(users)
        self.assertNotIn(users[1], manager.filter(tags__name='nice'))
        self.assertRaises(ValueError, manager.filter, tags__x='y')

        companies = [{
            'name':
            'blackbooks',
            'employees': [{
                'name': 'Manny',
                'tags': [
                    {
                        'name': 'nice'
                    },
                    {
                        'name': 'friendly'
                    },
                ]
            }]
        }, {
            'name':
            'community',
            'employees': [{
                'name': 'Britta',
                'tags': [
                    {
                        'name': 'activist'
                    },
                ]
            }]
        }]
        manager = lifter.load(companies)
        self.assertNotIn(companies[1],
                         manager.filter(employees__tags__name='friendly'))
Esempio n. 2
0
    def test_can_check_nested_iterables(self):
        users = [
            {
                'name': 'Kurt',
                'tags': [
                    {'name': 'nice'},
                    {'name': 'friendly'},
                ]
            },
            {
                'name': 'Bill',
                'tags': [
                    {'name': 'friendly'},
                ]
            },
        ]
        manager = lifter.load(users)
        self.assertNotIn(users[1], manager.filter(tags__name='nice'))
        self.assertRaises(ValueError, manager.filter, tags__x='y')

        companies = [
            {
                'name': 'blackbooks',
                'employees': [
                    {
                        'name': 'Manny',
                        'tags': [
                            {'name': 'nice'},
                            {'name': 'friendly'},
                        ]
                    }
                ]
            },
            {
                'name': 'community',
                'employees': [
                    {
                        'name': 'Britta',
                        'tags': [
                            {'name': 'activist'},
                        ]
                    }
                ]
            }
        ]
        manager = lifter.load(companies)
        self.assertNotIn(companies[1], manager.filter(employees__tags__name='friendly'))
Esempio n. 3
0
 def setUp(self):
     self.manager = lifter.load(self.OBJECTS)
     self.dict_manager = lifter.load(self.DICTS)
Esempio n. 4
0
 def setUp(self):
     self.manager = lifter.load(self.OBJECTS)
     self.dict_manager = lifter.load(self.DICTS)
Esempio n. 5
0
 def lifter_version(self, setup_data):
     manager = lifter.load(setup_data['test_data'])
     return manager.order_by('age')
Esempio n. 6
0
 def lifter_version(self, setup_data):
     manager = lifter.load(setup_data['test_data'])
     return manager.filter(age=42, is_active=True).count()
Esempio n. 7
0
 def lifter_version(self, setup_data):
     manager = lifter.load(setup_data["test_data"])
     return manager.order_by("age")
Esempio n. 8
0
 def lifter_version(self, setup_data):
     manager = lifter.load(setup_data["test_data"])
     return manager.filter(age=42, is_active=True).count()