def test_sign(self): Alphabet.objects.create(a=123, b=0, c=-999) ab = Alphabet.objects.annotate( asign=Sign("a"), bsign=Sign("b"), csign=Sign("c") ).first() assert ab.asign == 1 assert ab.bsign == 0 assert ab.csign == -1
def test_sign(self): Alphabet.objects.create(a=123, b=0, c=-999) with self.assertWarnsMessage(DeprecationWarning, "This function is deprecated."): kwargs = { "asign": Sign("a"), "bsign": Sign("b"), "csign": Sign("c"), } ab = Alphabet.objects.annotate(**kwargs).first() assert ab.asign == 1 assert ab.bsign == 0 assert ab.csign == -1