diff options
| author | Tim Graham <timograham@gmail.com> | 2024-12-18 06:50:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-18 08:50:48 -0300 |
| commit | bb6114ce5094eca25c52a7a1a56156d512cba065 (patch) | |
| tree | 1cf61bcbcbc375970c4e9a30d43364dcc506cb18 /tests/db_functions/math | |
| parent | 20f9f6180531279785ceabed6ab2f29ab634d8dc (diff) | |
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."
Diffstat (limited to 'tests/db_functions/math')
| -rw-r--r-- | tests/db_functions/math/test_round.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/db_functions/math/test_round.py b/tests/db_functions/math/test_round.py index 04ece4246d..c110dc71ca 100644 --- a/tests/db_functions/math/test_round.py +++ b/tests/db_functions/math/test_round.py @@ -112,7 +112,8 @@ class RoundTests(TestCase): IntegerModel.objects.create(normal=365) obj = IntegerModel.objects.annotate(normal_round=Round("normal", -1)).first() self.assertIsInstance(obj.normal_round, int) - self.assertEqual(obj.normal_round, 370) + expected = 360 if connection.features.rounds_to_even else 370 + self.assertEqual(obj.normal_round, expected) def test_transform(self): with register_lookup(DecimalField, Round): |
