'Tests slice queries for object models that are using db_field mapping
@since 3.1
@jira_ticket PYTHON-351
@expected_result results are properly retrieved without errors
@test_category object_mapper'

@execute_count(21)
def test_slice(self):

    for model in self.model_list:
        values = {'k0': 1, 'k1': 3, 'c0': 3, 'v0': 4, 'v1': 5}
        clustering_values = range(3)
        for c in clustering_values:
            values['c0'] = c
            i = model.create(**values)
        self.assertEqual(model.objects(k0=i.k0, k1=i.k1).count(), len(clustering_values))
        self.assertEqual(model.objects(k0=i.k0, k1=i.k1, c0=i.c0).count(), 1)
        self.assertEqual(model.objects(k0=i.k0, k1=i.k1, c0__lt=i.c0).count(), len(clustering_values[:(-1)]))
        self.assertEqual(model.objects(k0=i.k0, k1=i.k1, c0__gt=0).count(), len(clustering_values[1:]))
