def test_no_rows(self): out = Alphabet.objects.all().aggregate(BitAnd('a')) # Manual: # "This function returns 18446744073709551615 if there were no matching # rows. (This is the value of an unsigned BIGINT value with all bits # set to 1.)" assert out == {'a__bitand': 18446744073709551615}
def test_explicit_name(self): Alphabet.objects.bulk_create([Alphabet(a=11), Alphabet(a=24)]) out = Alphabet.objects.all().aggregate(aaa=BitAnd('a')) assert out == {'aaa': 8}
def test_implicit_name(self): Alphabet.objects.bulk_create([Alphabet(a=29), Alphabet(a=15)]) out = Alphabet.objects.all().aggregate(BitAnd('a')) assert out == {'a__bitand': 13}