add rename key to sort key

This commit is contained in:
2025-08-19 15:04:37 -03:00
parent 3ee190c66f
commit 18221ee1f4
4 changed files with 71 additions and 20 deletions

View File

@@ -31,24 +31,42 @@ def test_serialize():
'ip': {'S': '127.0.0.1'},
}
assert serialize(
{'ids': ('1', '2', '3')},
) == {
'ids': {
'L': [{'S': '1'}, {'S': '2'}, {'S': '3'}],
}
}
assert (
'SS'
in serialize(
{'ids': ('1', '2', '3')},
)['ids']
)
assert serialize(
{'ids': ['1', '2', '3']},
) == {
'ids': {
'L': [{'S': '1'}, {'S': '2'}, {'S': '3'}],
}
}
assert (
'SS'
in serialize(
{'ids': ['1', '2', '3']},
)['ids']
)
assert serialize({'ids': {'1'}}) == {'ids': {'SS': ['1']}}
assert serialize(
{
'users': [
{'name': 'Sérgio'},
{'name': 'Tiago'},
]
},
) == {
'users': {
'L': [
{
'M': {'name': {'S': 'Sérgio'}},
},
{
'M': {'name': {'S': 'Tiago'}},
},
]
}
}
def test_composekey():
key = ComposeKey(('122', 'abc'), prefix='schedules', delimiter=':')
@@ -263,7 +281,11 @@ def test_collection_get_items(
)
+ SortKey('0')
+ SortKey('0')
+ SortKey('metadata#billing_policy', path_spec='payment_method')
+ SortKey(
'metadata#billing_policy',
path_spec='payment_method',
rename_key='payment_method',
)
+ SortKey('metadata#payment_policy', remove_prefix='metadata#'),
)
@@ -273,7 +295,7 @@ def test_collection_get_items(
'id': 'cJtK9SsnJhKPyxESe7g3DG',
'cnpj': '15608435000190',
'email': 'org+15608435000190@users.noreply.betaeducacao.com.br',
'metadata#billing_policy': 'PIX',
'payment_method': 'PIX',
'payment_policy': {'due_days': Decimal('90')},
}