Skip to content
Browse files

Add an integration test for large integers

Noticed #1176 mentioned large integers so I figured
added an explicit integration test for this wouldn't be
a bad idea.
  • Loading branch information...
1 parent 2ef10ba commit 6f9ff248374a132cae3a0bc9c2303dad0b695725 @jamesls committed Dec 13, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 tests/integration/dynamodb/test_layer2.py
View
13 tests/integration/dynamodb/test_layer2.py
@@ -459,3 +459,16 @@ def test_lossy_float_conversion(self):
self.assertNotEqual(1.12345678912345, retrieved)
# Instead, it's truncated:
self.assertEqual(1.12345678912, retrieved)
+
+ def test_large_integers(self):
+ # It's not just floating point numbers, large integers
+ # can trigger rouding issues.
+ self.dynamodb.use_decimals()
+ table = self.create_sample_table()
+ item = table.new_item('foo', 'bar')
+ item['decimalvalue'] = Decimal('129271300103398600')
+ item.put()
+ retrieved = table.get_item('foo', 'bar')
+ self.assertEqual(retrieved['decimalvalue'], Decimal('129271300103398600'))
+ # Also comparable directly to an int.
+ self.assertEqual(retrieved['decimalvalue'], 129271300103398600)

0 comments on commit 6f9ff24

Please sign in to comment.
Something went wrong with that request. Please try again.