Use Decimal (properly) everywhere.

This commit is contained in:
Ben Konrath 2012-10-11 14:19:29 +02:00
parent 6f736a6823
commit 1d054f9572
2 changed files with 4 additions and 4 deletions

View File

@ -77,7 +77,7 @@ class IntegrationTestFiltering(TestCase):
self.assertEquals(response.data, self.data) self.assertEquals(response.data, self.data)
# Tests that the decimal filter works. # Tests that the decimal filter works.
search_decimal = 2.25 search_decimal = Decimal('2.25')
request = factory.get('/?decimal=%s' % search_decimal) request = factory.get('/?decimal=%s' % search_decimal)
response = view(request).render() response = view(request).render()
self.assertEquals(response.status_code, status.HTTP_200_OK) self.assertEquals(response.status_code, status.HTTP_200_OK)
@ -106,7 +106,7 @@ class IntegrationTestFiltering(TestCase):
self.assertEquals(response.data, self.data) self.assertEquals(response.data, self.data)
# Tests that the decimal filter set with 'lt' in the filter class works. # 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) request = factory.get('/?decimal=%s' % search_decimal)
response = view(request).render() response = view(request).render()
self.assertEquals(response.status_code, status.HTTP_200_OK) self.assertEquals(response.status_code, status.HTTP_200_OK)
@ -130,7 +130,7 @@ class IntegrationTestFiltering(TestCase):
self.assertEquals(response.data, expected_data) self.assertEquals(response.data, expected_data)
# Tests that multiple filters works. # Tests that multiple filters works.
search_decimal = 5.25 search_decimal = Decimal('5.25')
search_date = datetime.date(2012, 10, 2) search_date = datetime.date(2012, 10, 2)
request = factory.get('/?decimal=%s&date=%s' % (search_decimal, search_date)) request = factory.get('/?decimal=%s&date=%s' % (search_decimal, search_date))
response = view(request).render() response = view(request).render()

View File

@ -84,7 +84,7 @@ class IntegrationTestPaginationAndFiltering(TestCase):
""" """
Create 50 FilterableItem instances. 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): for i in range(26):
text = chr(i + ord(base_data[0])) * 3 # Produces string 'aaa', 'bbb', etc. text = chr(i + ord(base_data[0])) * 3 # Produces string 'aaa', 'bbb', etc.
decimal = base_data[1] + i decimal = base_data[1] + i