fix retain key

This commit is contained in:
2025-05-23 10:30:54 -03:00
parent 812470aae4
commit a7ee787378
26 changed files with 117 additions and 166 deletions

View File

@@ -3,7 +3,6 @@ from decimal import Decimal
from ipaddress import IPv4Address
import pytest
from layercake.dateutils import ttl
from layercake.dynamodb import (
ComposeKey,
@@ -371,3 +370,23 @@ def test_collection_get_items_pair_unflatten(
'cpf': {'user_id': '5OxmMjL-ujoR5IMGegQz'},
'email': {'user_id': '5OxmMjL-ujoR5IMGegQz'},
}
def test_collection_get_items_pair_path_spec(
dynamodb_seeds,
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
):
collect = DynamoDBCollection(dynamodb_persistence_layer)
doc = collect.get_items(
KeyPair('cpf', SortKey('07879819908', path_spec='user_id', retain_key=True))
+ KeyPair(
'email',
SortKey('osergiosiqueira@gmail.com', path_spec='user_id', retain_key=True),
),
flatten_top=False,
)
assert doc == {
'cpf': '5OxmMjL-ujoR5IMGegQz',
'email': '5OxmMjL-ujoR5IMGegQz',
}