MCPcopy
hub / github.com/django/django / test_integer

Method test_integer

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

Source from the content-addressed store, hash-verified

30 self.assertAlmostEqual(obj.f_mod, math.fmod(obj.f1, obj.f2))
31
32 def test_integer(self):
33 IntegerModel.objects.create(small=20, normal=15, big=1)
34 obj = IntegerModel.objects.annotate(
35 small_mod=Mod("small", "normal"),
36 normal_mod=Mod("normal", "big"),
37 big_mod=Mod("big", "small"),
38 ).first()
39 self.assertIsInstance(obj.small_mod, float)
40 self.assertIsInstance(obj.normal_mod, float)
41 self.assertIsInstance(obj.big_mod, float)
42 self.assertEqual(obj.small_mod, math.fmod(obj.small, obj.normal))
43 self.assertEqual(obj.normal_mod, math.fmod(obj.normal, obj.big))
44 self.assertEqual(obj.big_mod, math.fmod(obj.big, obj.small))

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