MCPcopy
hub / github.com/django/django / test_transform

Method test_transform

tests/db_functions/math/test_sqrt.py:52–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

50 self.assertAlmostEqual(obj.big_sqrt, math.sqrt(obj.big))
51
52 def test_transform(self):
53 with register_lookup(DecimalField, Sqrt):
54 DecimalModel.objects.create(n1=Decimal("6.0"), n2=Decimal("0"))
55 DecimalModel.objects.create(n1=Decimal("1.0"), n2=Decimal("0"))
56 obj = DecimalModel.objects.filter(n1__sqrt__gt=2).get()
57 self.assertEqual(obj.n1, Decimal("6.0"))

Callers

nothing calls this directly

Calls 4

register_lookupFunction · 0.90
createMethod · 0.45
getMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected