Example #1
0
 def test_explicit_name(self):
     Alphabet.objects.bulk_create([Alphabet(a=29), Alphabet(a=15)])
     out = Alphabet.objects.all().aggregate(aaa=BitOr('a'))
     assert out == {'aaa': 31}
Example #2
0
 def test_no_rows(self):
     out = Alphabet.objects.all().aggregate(BitOr('a'))
     # Manual:
     # "This function returns 0 if there were no matching rows."
     assert out == {'a__bitor': 0}
Example #3
0
 def test_implicit_name(self):
     Alphabet.objects.bulk_create([Alphabet(a=1), Alphabet(a=84)])
     out = Alphabet.objects.all().aggregate(BitOr('a'))
     assert out == {'a__bitor': 85}