예제 #1
0
    def test_combine_auto_parse(self):
        instance = TestModel.objects.create(hll_field=HllEmpty() | 2 | 3)
        self.assertEqual(
            2,
            TestModel.objects.annotate(card=Cardinality('hll_field')).filter(
                pk=instance.pk).values_list('card', flat=True)[0])

        instance = TestModel.objects.create(hll_field=HllEmpty() | {2, 3})
        self.assertEqual(
            2,
            TestModel.objects.annotate(card=Cardinality('hll_field')).filter(
                pk=instance.pk).values_list('card', flat=True)[0])
예제 #2
0
    def setUp(self):
        self.cursor = connection.cursor()

        TestModel.objects.bulk_create([
            TestModel(id=100501, hll_field=HllEmpty()),
            TestModel(id=100502, hll_field=HllInteger(1)),
            TestModel(id=100503, hll_field=HllInteger(2))
        ])
예제 #3
0
 def test_create_custom_params(self):
     TestConfiguredModel.objects.create(hll_field=HllEmpty(13, 2, 1, 0))
예제 #4
0
 def test_create(self):
     TestModel.objects.create(hll_field=HllEmpty())
예제 #5
0
 def setUp(self):
     TestModel.objects.create(id=100501, hll_field=HllEmpty()),
예제 #6
0
 def test_combine(self):
     TestModel.objects.create(hll_field=HllEmpty() | HllInteger(1)
                              | HllInteger(2))
예제 #7
0
 def setUp(self):
     self.default = TestModel.objects.create(id=100501,
                                             hll_field=HllEmpty())
     self.non_default = TestConfiguredModel.objects.create(
         id=100502, hll_field=HllEmpty(13, 2, 1, 0))
예제 #8
0
 def setUp(self):
     TestModel.objects.bulk_create([
         TestModel(id=100501, hll_field=HllEmpty()),
         TestModel(id=100502, hll_field=HllInteger(1) | HllInteger(2)),
         TestModel(id=100503, hll_field=HllInteger(2))
     ])