MCPcopy
hub / github.com/django/django / test_decimal

Method test_decimal

tests/db_functions/math/test_mod.py:20–24  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

18 self.assertIsNone(obj.null_mod_normal)
19
20 def test_decimal(self):
21 DecimalModel.objects.create(n1=Decimal("-9.9"), n2=Decimal("4.6"))
22 obj = DecimalModel.objects.annotate(n_mod=Mod("n1", "n2")).first()
23 self.assertIsInstance(obj.n_mod, Decimal)
24 self.assertAlmostEqual(obj.n_mod, Decimal(math.fmod(obj.n1, obj.n2)))
25
26 def test_float(self):
27 FloatModel.objects.create(f1=-25, f2=0.33)

Callers

nothing calls this directly

Calls 4

ModClass · 0.90
firstMethod · 0.80
annotateMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected