mirror of
https://github.com/django/django.git
synced 2025-03-28 02:00:45 +00:00
Refs #6767 -- Added test for fetching decimal values without rounding error on Oracle.
This commit is contained in:
parent
620e9dd31a
commit
f32ee6d0ec
@ -1,8 +1,10 @@
|
|||||||
|
import unittest
|
||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from django.core import validators
|
from django.core import validators
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import connection, models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from .models import BigD, Foo
|
from .models import BigD, Foo
|
||||||
@ -49,6 +51,12 @@ class DecimalFieldTests(TestCase):
|
|||||||
bd = BigD.objects.get(pk=bd.pk)
|
bd = BigD.objects.get(pk=bd.pk)
|
||||||
self.assertEqual(bd.d, Decimal('12.9'))
|
self.assertEqual(bd.d, Decimal('12.9'))
|
||||||
|
|
||||||
|
@unittest.skipIf(connection.vendor == 'sqlite', 'SQLite stores values rounded to 15 significant digits.')
|
||||||
|
def test_fetch_from_db_without_float_rounding(self):
|
||||||
|
big_decimal = BigD.objects.create(d=Decimal('.100000000000000000000000000005'))
|
||||||
|
big_decimal.refresh_from_db()
|
||||||
|
self.assertEqual(big_decimal.d, Decimal('.100000000000000000000000000005'))
|
||||||
|
|
||||||
def test_lookup_really_big_value(self):
|
def test_lookup_really_big_value(self):
|
||||||
"""
|
"""
|
||||||
Really big values can be used in a filter statement.
|
Really big values can be used in a filter statement.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user