Skip to content

Commit 84cc78a

Browse files
committed
add unit test for large numbers
1 parent 04b4cd2 commit 84cc78a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/unit/data_classes/required_dependencies/test_dynamo_db_stream_event.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,27 @@ def test_dynamodb_stream_trigger_event():
4444
assert dynamodb.stream_view_type == StreamViewType.NEW_AND_OLD_IMAGES
4545

4646

47+
def test_dynamodb_stream_record_deserialization_large_int():
48+
decimal_context = Context(
49+
Emin=-128,
50+
Emax=126,
51+
prec=38,
52+
traps=[Clamped, Overflow, Inexact, Rounded, Underflow],
53+
)
54+
data = {
55+
"Keys": {"key1": {"attr1": "value1"}},
56+
"NewImage": {
57+
"Name": {"S": "Joe"},
58+
"Age": {"N": "11011111111111111000000000000000000000000000000"},
59+
},
60+
}
61+
record = StreamRecord(data)
62+
assert record.new_image == {
63+
"Name": "Joe",
64+
"Age": decimal_context.create_decimal("11011111111111111000000000000000000000"),
65+
}
66+
67+
4768
def test_dynamodb_stream_record_deserialization():
4869
byte_list = [s.encode("utf-8") for s in ["item1", "item2"]]
4970
decimal_context = Context(

0 commit comments

Comments
 (0)