@@ -57,9 +57,16 @@ def base_transact_get_item_request(keys):
57
57
58
58
# Base exhaustive request structures that are shared between DDB and dict formats
59
59
60
+ # No exhaustive requests are intended to be able to be used as real requests.
61
+ # Some parameters conflict with each other when sent to DynamoDB.
62
+ # These are only intended to test the conversion of the request from client to resource format.
60
63
61
64
def base_exhaustive_put_item_request (item ):
62
- """Base structure for exhaustive put_item requests."""
65
+ """Base structure for exhaustive put_item requests.
66
+ This is not intended to be able to be used as a real request.
67
+ Some parameters conflict with each other when sent to DynamoDB.
68
+ This is only intended to test the conversion of the request from client to resource format.
69
+ """
63
70
return {
64
71
# Expected is legacy, but still in the boto3 docs.
65
72
"Expected" : {
@@ -78,7 +85,11 @@ def base_exhaustive_put_item_request(item):
78
85
79
86
80
87
def base_exhaustive_get_item_request (item ):
81
- """Base structure for exhaustive get_item requests."""
88
+ """Base structure for exhaustive get_item requests.
89
+ This is not intended to be able to be used as a real request.
90
+ Some parameters conflict with each other when sent to DynamoDB.
91
+ This is only intended to test the conversion of the request from client to resource format.
92
+ """
82
93
return {
83
94
"ReturnConsumedCapacity" : "TOTAL" ,
84
95
"ReturnItemCollectionMetrics" : "SIZE" ,
@@ -95,7 +106,11 @@ def base_exhaustive_get_item_request(item):
95
106
96
107
97
108
def base_exhaustive_query_request (item ):
98
- """Base structure for exhaustive query requests."""
109
+ """Base structure for exhaustive query requests.
110
+ This is not intended to be able to be used as a real request.
111
+ Some parameters conflict with each other when sent to DynamoDB.
112
+ This is only intended to test the conversion of the request from client to resource format.
113
+ """
99
114
return {
100
115
"IndexName" : "index_name" ,
101
116
"Select" : "SPECIFIC_ATTRIBUTES" ,
@@ -119,7 +134,11 @@ def base_exhaustive_query_request(item):
119
134
120
135
121
136
def base_exhaustive_scan_request (item ):
122
- """Base structure for exhaustive scan requests."""
137
+ """Base structure for exhaustive scan requests.
138
+ This is not intended to be able to be used as a real request.
139
+ Some parameters conflict with each other when sent to DynamoDB.
140
+ This is only intended to test the conversion of the request from client to resource format.
141
+ """
123
142
return {
124
143
"IndexName" : "index_name" ,
125
144
"AttributesToGet" : ["partition_key" , "sort_key" , "attribute1" , "attribute2" ],
@@ -267,8 +286,14 @@ def basic_put_item_request_dict(item):
267
286
268
287
269
288
def exhaustive_put_item_request_dict (item ):
270
- """Get a put_item request in dict format for any item."""
289
+ """Get a put_item request in dict format for any item.
290
+ This is not intended to be able to be used as a real request.
291
+ Some parameters conflict with each other when sent to DynamoDB.
292
+ This is only intended to test the conversion of the request from client to resource format.
293
+ """
271
294
base = basic_put_item_request_dict (item )
295
+ # Replace the default ConditionExpression string with a ConditionExpression object
296
+ # to increase test coverage.
272
297
additional_keys = base_exhaustive_put_item_request (item )
273
298
additional_keys ["ConditionExpression" ] = Attr ("#pk" ).not_exists () & Attr ("#sk" ).not_exists ()
274
299
return {** base , ** additional_keys }
@@ -280,7 +305,11 @@ def basic_get_item_request_dict(item):
280
305
281
306
282
307
def exhaustive_get_item_request_dict (item ):
283
- """Get a get_item request in dict format for any item."""
308
+ """Get a get_item request in dict format for any item.
309
+ This is not intended to be able to be used as a real request.
310
+ Some parameters conflict with each other when sent to DynamoDB.
311
+ This is only intended to test the conversion of the request from client to resource format.
312
+ """
284
313
base = basic_get_item_request_dict (item )
285
314
additional_keys = base_exhaustive_get_item_request (item )
286
315
return {** base , ** additional_keys }
@@ -296,12 +325,17 @@ def basic_query_request_dict(item):
296
325
def basic_query_request_dict_condition_expression (item ):
297
326
"""Get a query request in dict format for any item."""
298
327
base = base_query_request (item )
299
- # Override base KeyConditionExpression to use ConditionExpressions
328
+ # Replace the default KeyConditionExpression string with a ConditionExpression object
329
+ # to increase test coverage.
300
330
return {"KeyConditionExpression" : Key ("partition_key" ).eq (item ["partition_key" ]), ** base }
301
331
302
332
303
333
def exhaustive_query_request_dict (item ):
304
- """Get a query request in dict format for any item."""
334
+ """Get a query request in dict format for any item.
335
+ This is not intended to be able to be used as a real request.
336
+ Some parameters conflict with each other when sent to DynamoDB.
337
+ This is only intended to test the conversion of the request from client to resource format.
338
+ """
305
339
base = basic_query_request_dict (item )
306
340
additional_keys = base_exhaustive_query_request (item )
307
341
return {** base , ** additional_keys }
@@ -313,7 +347,11 @@ def basic_scan_request_dict(item):
313
347
314
348
315
349
def exhaustive_scan_request_dict (item ):
316
- """Get a scan request in dict format for any item."""
350
+ """Get a scan request in dict format for any item.
351
+ This is not intended to be able to be used as a real request.
352
+ Some parameters conflict with each other when sent to DynamoDB.
353
+ This is only intended to test the conversion of the request from client to resource format.
354
+ """
317
355
base = basic_scan_request_dict (item )
318
356
additional_keys = base_exhaustive_scan_request (item )
319
357
return {** base , ** additional_keys }
0 commit comments