aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests
diff options
context:
space:
mode:
authorBen Konrath2012-10-11 14:19:29 +0200
committerBen Konrath2012-10-11 14:19:29 +0200
commit1d054f95725e5bec7d4ba9d23717897ef80b7388 (patch)
tree122b9143e8dd3f24645ee6fd39a89fef404f5fe6 /rest_framework/tests
parent6f736a682369e003e4ae4b8d587f9168d4196986 (diff)
downloaddjango-rest-framework-1d054f95725e5bec7d4ba9d23717897ef80b7388.tar.bz2
Use Decimal (properly) everywhere.
Diffstat (limited to 'rest_framework/tests')
-rw-r--r--rest_framework/tests/filterset.py6
-rw-r--r--rest_framework/tests/pagination.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/rest_framework/tests/filterset.py b/rest_framework/tests/filterset.py
index 5b2721ff..5374eefc 100644
--- a/rest_framework/tests/filterset.py
+++ b/rest_framework/tests/filterset.py
@@ -77,7 +77,7 @@ class IntegrationTestFiltering(TestCase):
self.assertEquals(response.data, self.data)
# Tests that the decimal filter works.
- search_decimal = 2.25
+ search_decimal = Decimal('2.25')
request = factory.get('/?decimal=%s' % search_decimal)
response = view(request).render()
self.assertEquals(response.status_code, status.HTTP_200_OK)
@@ -106,7 +106,7 @@ class IntegrationTestFiltering(TestCase):
self.assertEquals(response.data, self.data)
# Tests that the decimal filter set with 'lt' in the filter class works.
- search_decimal = 4.25
+ search_decimal = Decimal('4.25')
request = factory.get('/?decimal=%s' % search_decimal)
response = view(request).render()
self.assertEquals(response.status_code, status.HTTP_200_OK)
@@ -130,7 +130,7 @@ class IntegrationTestFiltering(TestCase):
self.assertEquals(response.data, expected_data)
# Tests that multiple filters works.
- search_decimal = 5.25
+ search_decimal = Decimal('5.25')
search_date = datetime.date(2012, 10, 2)
request = factory.get('/?decimal=%s&date=%s' % (search_decimal, search_date))
response = view(request).render()
diff --git a/rest_framework/tests/pagination.py b/rest_framework/tests/pagination.py
index 8c5e6ad7..170515a7 100644
--- a/rest_framework/tests/pagination.py
+++ b/rest_framework/tests/pagination.py
@@ -84,7 +84,7 @@ class IntegrationTestPaginationAndFiltering(TestCase):
"""
Create 50 FilterableItem instances.
"""
- base_data = ('a', Decimal(0.25), datetime.date(2012, 10, 8))
+ base_data = ('a', Decimal('0.25'), datetime.date(2012, 10, 8))
for i in range(26):
text = chr(i + ord(base_data[0])) * 3 # Produces string 'aaa', 'bbb', etc.
decimal = base_data[1] + i