1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Refs #33476 -- Reformatted code with Black.

This commit is contained in:
django-bot
2022-02-03 20:24:19 +01:00
committed by Mariusz Felisiak
parent f68fa8b45d
commit 9c19aff7c7
1992 changed files with 139577 additions and 96284 deletions

View File

@@ -8,35 +8,34 @@ from ..models import DecimalModel, FloatModel, IntegerModel
class ATan2Tests(TestCase):
def test_null(self):
IntegerModel.objects.create(big=100)
obj = IntegerModel.objects.annotate(
null_atan2_sn=ATan2('small', 'normal'),
null_atan2_nb=ATan2('normal', 'big'),
null_atan2_bn=ATan2('big', 'normal'),
null_atan2_sn=ATan2("small", "normal"),
null_atan2_nb=ATan2("normal", "big"),
null_atan2_bn=ATan2("big", "normal"),
).first()
self.assertIsNone(obj.null_atan2_sn)
self.assertIsNone(obj.null_atan2_nb)
self.assertIsNone(obj.null_atan2_bn)
def test_decimal(self):
DecimalModel.objects.create(n1=Decimal('-9.9'), n2=Decimal('4.6'))
obj = DecimalModel.objects.annotate(n_atan2=ATan2('n1', 'n2')).first()
DecimalModel.objects.create(n1=Decimal("-9.9"), n2=Decimal("4.6"))
obj = DecimalModel.objects.annotate(n_atan2=ATan2("n1", "n2")).first()
self.assertIsInstance(obj.n_atan2, Decimal)
self.assertAlmostEqual(obj.n_atan2, Decimal(math.atan2(obj.n1, obj.n2)))
def test_float(self):
FloatModel.objects.create(f1=-25, f2=0.33)
obj = FloatModel.objects.annotate(f_atan2=ATan2('f1', 'f2')).first()
obj = FloatModel.objects.annotate(f_atan2=ATan2("f1", "f2")).first()
self.assertIsInstance(obj.f_atan2, float)
self.assertAlmostEqual(obj.f_atan2, math.atan2(obj.f1, obj.f2))
def test_integer(self):
IntegerModel.objects.create(small=0, normal=1, big=10)
obj = IntegerModel.objects.annotate(
atan2_sn=ATan2('small', 'normal'),
atan2_nb=ATan2('normal', 'big'),
atan2_sn=ATan2("small", "normal"),
atan2_nb=ATan2("normal", "big"),
).first()
self.assertIsInstance(obj.atan2_sn, float)
self.assertIsInstance(obj.atan2_nb, float)