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

Method test_transform

tests/db_functions/math/test_round.py:118–123  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

116 self.assertEqual(obj.normal_round, expected)
117
118 def test_transform(self):
119 with register_lookup(DecimalField, Round):
120 DecimalModel.objects.create(n1=Decimal("2.0"), n2=Decimal("0"))
121 DecimalModel.objects.create(n1=Decimal("-1.0"), n2=Decimal("0"))
122 obj = DecimalModel.objects.filter(n1__round__gt=0).get()
123 self.assertEqual(obj.n1, Decimal("2.0"))
124
125 @unittest.skipUnless(
126 connection.vendor == "sqlite",

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