예제 #1
0
 def test_explicit_name(self):
     Alphabet.objects.bulk_create([Alphabet(a=123), Alphabet(a=456)])
     out = Alphabet.objects.all().aggregate(aaa=BitXor('a'))
     assert out == {'aaa': 435}
예제 #2
0
 def test_no_rows(self):
     out = Alphabet.objects.all().aggregate(BitXor('a'))
     # Manual:
     # "This function returns 0 if there were no matching rows."
     assert out == {'a__bitxor': 0}
예제 #3
0
 def test_implicit_name(self):
     Alphabet.objects.bulk_create([Alphabet(a=11), Alphabet(a=3)])
     out = Alphabet.objects.all().aggregate(BitXor('a'))
     assert out == {'a__bitxor': 8}