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'))
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'))
def setUp(self): self.manager = lifter.load(self.OBJECTS) self.dict_manager = lifter.load(self.DICTS)
def lifter_version(self, setup_data): manager = lifter.load(setup_data['test_data']) return manager.order_by('age')
def lifter_version(self, setup_data): manager = lifter.load(setup_data['test_data']) return manager.filter(age=42, is_active=True).count()
def lifter_version(self, setup_data): manager = lifter.load(setup_data["test_data"]) return manager.order_by("age")
def lifter_version(self, setup_data): manager = lifter.load(setup_data["test_data"]) return manager.filter(age=42, is_active=True).count()