mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Added DatabaseFeatures.rounds_to_even.
This feature flag useful with MongoDB: "Rounding to the nearest even value supports more even distribution of rounded data than always rounding up or down."
This commit is contained in:
@@ -52,7 +52,8 @@ class CastTests(TestCase):
|
||||
),
|
||||
).get()
|
||||
self.assertEqual(float_obj.cast_f1_decimal, decimal.Decimal("-1.93"))
|
||||
self.assertEqual(float_obj.cast_f2_decimal, decimal.Decimal("3.5"))
|
||||
expected = "3.4" if connection.features.rounds_to_even else "3.5"
|
||||
self.assertEqual(float_obj.cast_f2_decimal, decimal.Decimal(expected))
|
||||
author_obj = Author.objects.annotate(
|
||||
cast_alias_decimal=Cast(
|
||||
"alias", models.DecimalField(max_digits=8, decimal_places=2)
|
||||
|
||||
Reference in New Issue
Block a user