summaryrefslogtreecommitdiff
path: root/tests/db_functions/math/test_mod.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/db_functions/math/test_mod.py')
-rw-r--r--tests/db_functions/math/test_mod.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/db_functions/math/test_mod.py b/tests/db_functions/math/test_mod.py
index dc363432b7..919b9419d2 100644
--- a/tests/db_functions/math/test_mod.py
+++ b/tests/db_functions/math/test_mod.py
@@ -8,34 +8,33 @@ from ..models import DecimalModel, FloatModel, IntegerModel
class ModTests(TestCase):
-
def test_null(self):
IntegerModel.objects.create(big=100)
obj = IntegerModel.objects.annotate(
- null_mod_small=Mod('small', 'normal'),
- null_mod_normal=Mod('normal', 'big'),
+ null_mod_small=Mod("small", "normal"),
+ null_mod_normal=Mod("normal", "big"),
).first()
self.assertIsNone(obj.null_mod_small)
self.assertIsNone(obj.null_mod_normal)
def test_decimal(self):
- DecimalModel.objects.create(n1=Decimal('-9.9'), n2=Decimal('4.6'))
- obj = DecimalModel.objects.annotate(n_mod=Mod('n1', 'n2')).first()
+ DecimalModel.objects.create(n1=Decimal("-9.9"), n2=Decimal("4.6"))
+ obj = DecimalModel.objects.annotate(n_mod=Mod("n1", "n2")).first()
self.assertIsInstance(obj.n_mod, Decimal)
self.assertAlmostEqual(obj.n_mod, Decimal(math.fmod(obj.n1, obj.n2)))
def test_float(self):
FloatModel.objects.create(f1=-25, f2=0.33)
- obj = FloatModel.objects.annotate(f_mod=Mod('f1', 'f2')).first()
+ obj = FloatModel.objects.annotate(f_mod=Mod("f1", "f2")).first()
self.assertIsInstance(obj.f_mod, float)
self.assertAlmostEqual(obj.f_mod, math.fmod(obj.f1, obj.f2))
def test_integer(self):
IntegerModel.objects.create(small=20, normal=15, big=1)
obj = IntegerModel.objects.annotate(
- small_mod=Mod('small', 'normal'),
- normal_mod=Mod('normal', 'big'),
- big_mod=Mod('big', 'small'),
+ small_mod=Mod("small", "normal"),
+ normal_mod=Mod("normal", "big"),
+ big_mod=Mod("big", "small"),
).first()
self.assertIsInstance(obj.small_mod, float)
self.assertIsInstance(obj.normal_mod, float)