summaryrefslogtreecommitdiff
path: root/tests/db_functions/math/test_acos.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/db_functions/math/test_acos.py')
-rw-r--r--tests/db_functions/math/test_acos.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/db_functions/math/test_acos.py b/tests/db_functions/math/test_acos.py
index b5cac88eea..fe77866320 100644
--- a/tests/db_functions/math/test_acos.py
+++ b/tests/db_functions/math/test_acos.py
@@ -10,15 +10,16 @@ from ..models import DecimalModel, FloatModel, IntegerModel
class ACosTests(TestCase):
-
def test_null(self):
IntegerModel.objects.create()
- obj = IntegerModel.objects.annotate(null_acos=ACos('normal')).first()
+ obj = IntegerModel.objects.annotate(null_acos=ACos("normal")).first()
self.assertIsNone(obj.null_acos)
def test_decimal(self):
- DecimalModel.objects.create(n1=Decimal('-0.9'), n2=Decimal('0.6'))
- obj = DecimalModel.objects.annotate(n1_acos=ACos('n1'), n2_acos=ACos('n2')).first()
+ DecimalModel.objects.create(n1=Decimal("-0.9"), n2=Decimal("0.6"))
+ obj = DecimalModel.objects.annotate(
+ n1_acos=ACos("n1"), n2_acos=ACos("n2")
+ ).first()
self.assertIsInstance(obj.n1_acos, Decimal)
self.assertIsInstance(obj.n2_acos, Decimal)
self.assertAlmostEqual(obj.n1_acos, Decimal(math.acos(obj.n1)))
@@ -26,7 +27,9 @@ class ACosTests(TestCase):
def test_float(self):
FloatModel.objects.create(f1=-0.5, f2=0.33)
- obj = FloatModel.objects.annotate(f1_acos=ACos('f1'), f2_acos=ACos('f2')).first()
+ obj = FloatModel.objects.annotate(
+ f1_acos=ACos("f1"), f2_acos=ACos("f2")
+ ).first()
self.assertIsInstance(obj.f1_acos, float)
self.assertIsInstance(obj.f2_acos, float)
self.assertAlmostEqual(obj.f1_acos, math.acos(obj.f1))
@@ -35,9 +38,9 @@ class ACosTests(TestCase):
def test_integer(self):
IntegerModel.objects.create(small=0, normal=1, big=-1)
obj = IntegerModel.objects.annotate(
- small_acos=ACos('small'),
- normal_acos=ACos('normal'),
- big_acos=ACos('big'),
+ small_acos=ACos("small"),
+ normal_acos=ACos("normal"),
+ big_acos=ACos("big"),
).first()
self.assertIsInstance(obj.small_acos, float)
self.assertIsInstance(obj.normal_acos, float)
@@ -48,7 +51,7 @@ class ACosTests(TestCase):
def test_transform(self):
with register_lookup(DecimalField, ACos):
- DecimalModel.objects.create(n1=Decimal('0.5'), n2=Decimal('0'))
- DecimalModel.objects.create(n1=Decimal('-0.9'), n2=Decimal('0'))
+ DecimalModel.objects.create(n1=Decimal("0.5"), n2=Decimal("0"))
+ DecimalModel.objects.create(n1=Decimal("-0.9"), n2=Decimal("0"))
obj = DecimalModel.objects.filter(n1__acos__lt=2).get()
- self.assertEqual(obj.n1, Decimal('0.5'))
+ self.assertEqual(obj.n1, Decimal("0.5"))