cuenca-validations 2.1.35.dev2__py3-none-any.whl → 2.1.36__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cuenca_validations/types/queries.py +13 -1
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/RECORD +8 -8
- tests/test_types.py +15 -10
- {cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/top_level.txt +0 -0
|
@@ -40,7 +40,7 @@ class QueryParams(BaseModel):
|
|
|
40
40
|
]
|
|
41
41
|
limit: Optional[PositiveInt] = None
|
|
42
42
|
user_id: Optional[str] = None
|
|
43
|
-
ids: Optional[
|
|
43
|
+
ids: Optional[str] = None
|
|
44
44
|
created_before: Optional[dt.datetime] = None
|
|
45
45
|
created_after: Optional[dt.datetime] = None
|
|
46
46
|
related_transaction: Optional[str] = None
|
|
@@ -65,6 +65,18 @@ class QueryParams(BaseModel):
|
|
|
65
65
|
},
|
|
66
66
|
)
|
|
67
67
|
|
|
68
|
+
@field_validator('ids')
|
|
69
|
+
@classmethod
|
|
70
|
+
def validate_ids_count(cls, value: Optional[str]) -> Optional[str]:
|
|
71
|
+
if value is None:
|
|
72
|
+
return None
|
|
73
|
+
id_count = len([part for part in value.split(',') if part.strip()])
|
|
74
|
+
if id_count > MAX_PAGE_SIZE:
|
|
75
|
+
raise ValueError(
|
|
76
|
+
f'ids must contain at most {MAX_PAGE_SIZE} values'
|
|
77
|
+
)
|
|
78
|
+
return value
|
|
79
|
+
|
|
68
80
|
def model_dump(self, *args, **kwargs) -> DictStrAny:
|
|
69
81
|
kwargs.setdefault('exclude_none', True)
|
|
70
82
|
kwargs.setdefault('exclude_unset', True)
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.
|
|
1
|
+
__version__ = '2.1.36'
|
|
@@ -4,7 +4,7 @@ cuenca_validations/errors.py,sha256=OtM8EgiKqYdz9Hn66AbBO96orL1or7efkyt0vh0Zxbs,
|
|
|
4
4
|
cuenca_validations/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cuenca_validations/typing.py,sha256=1QCu81IbVZZpyInjyeAuO-nF36gpT5Gi4o6V9PozuOU,204
|
|
6
6
|
cuenca_validations/validators.py,sha256=zXSnU5-EMbQZBD-PfFXgP4Z6G7cm7KFDWXB7Nie6WUk,2682
|
|
7
|
-
cuenca_validations/version.py,sha256=
|
|
7
|
+
cuenca_validations/version.py,sha256=NxagHSMd_2KQmX6syN_zhx9VgbAl3sM24xYphxELkxk,23
|
|
8
8
|
cuenca_validations/types/__init__.py,sha256=RPS1vCWZe3JWfLg_9njQw-ubDR_JhosNCVSzA3Ue4L0,5575
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
10
|
cuenca_validations/types/enums.py,sha256=f-qMUdxLZsAqRvEwh3EcUsB2K-loufvPzdcK0JFQ1JY,20586
|
|
@@ -13,18 +13,18 @@ cuenca_validations/types/general.py,sha256=eYFYwyx_a4_J480GYpqW3DFbZabDFcUjvLRMQ
|
|
|
13
13
|
cuenca_validations/types/helpers.py,sha256=4veeLZbugHHqZk0ezSim978VhH6Vq8XTrEhe1eE_r3A,1531
|
|
14
14
|
cuenca_validations/types/identities.py,sha256=j2xxh3UYHJe6IbAwr9yNXJkebTth_-g3SUmHeiPez8M,5513
|
|
15
15
|
cuenca_validations/types/morals.py,sha256=davabh5hAnFVQyM7-yCyDaT5ewXnm0cr1BtqDIwzkX8,1833
|
|
16
|
-
cuenca_validations/types/queries.py,sha256=
|
|
16
|
+
cuenca_validations/types/queries.py,sha256=OonJ6CBDR6OF_kTv49AsE3zLEzQPCF4xpSqzSBpQgEs,5795
|
|
17
17
|
cuenca_validations/types/requests.py,sha256=PJ_JETvzGD3XsyHUiNMf_3yYbm8lKyymG1cHTcjazmY,24458
|
|
18
|
-
cuenca_validations-2.1.
|
|
18
|
+
cuenca_validations-2.1.36.dist-info/licenses/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
|
|
19
19
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
tests/test_card.py,sha256=QAfRz7e11gWICPnFJZ2tiYgUsFV3C9TwzJXrDnDNXFw,1202
|
|
21
21
|
tests/test_errors.py,sha256=ixiIgEuBuzfsL5p4uCFdF32XqFRtTPF6EVhGJ0keOrI,930
|
|
22
22
|
tests/test_helpers.py,sha256=fx2R7y6oQO8XeQzevJe826NuHkBgvtznZicomchB3Gg,899
|
|
23
23
|
tests/test_requests.py,sha256=3XMx2A-BK21g1Exm4RTVm6eKTOzeZH-8FzKJXQmmMmA,4141
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
|
-
tests/test_types.py,sha256=
|
|
25
|
+
tests/test_types.py,sha256=7ids3vS1x7M3Uqa3T4ucwMMpurtn87JmFF_8-bYwYUY,22495
|
|
26
26
|
tests/test_validators.py,sha256=Jjr9gWTT4cRntGiKvQK4fncqx3JkEuTWkKm1VqpRHTs,1829
|
|
27
|
-
cuenca_validations-2.1.
|
|
28
|
-
cuenca_validations-2.1.
|
|
29
|
-
cuenca_validations-2.1.
|
|
30
|
-
cuenca_validations-2.1.
|
|
27
|
+
cuenca_validations-2.1.36.dist-info/METADATA,sha256=9bMYY9wRFkZU7Xr6ON2BNFmObZV2nqYjqqyYGCuuAKs,1595
|
|
28
|
+
cuenca_validations-2.1.36.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
29
|
+
cuenca_validations-2.1.36.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
30
|
+
cuenca_validations-2.1.36.dist-info/RECORD,,
|
tests/test_types.py
CHANGED
|
@@ -248,28 +248,33 @@ def test_user_query_rejects_invalid(field, value):
|
|
|
248
248
|
|
|
249
249
|
|
|
250
250
|
def test_user_query_accepts_ids_and_is_blocked():
|
|
251
|
-
query = UserQuery(ids=
|
|
252
|
-
assert query.ids ==
|
|
251
|
+
query = UserQuery(ids='US1,US2', is_blocked=True)
|
|
252
|
+
assert query.ids == 'US1,US2'
|
|
253
253
|
assert query.is_blocked is True
|
|
254
254
|
dumped = query.model_dump(exclude_none=True)
|
|
255
|
-
assert dumped['ids'] ==
|
|
255
|
+
assert dumped['ids'] == 'US1,US2'
|
|
256
256
|
assert dumped['is_blocked'] is True
|
|
257
|
-
assert isinstance(dumped['ids'],
|
|
257
|
+
assert isinstance(dumped['ids'], str)
|
|
258
258
|
|
|
259
259
|
|
|
260
260
|
def test_query_params_accepts_ids():
|
|
261
|
-
query = QueryParams(ids=
|
|
262
|
-
assert query.ids ==
|
|
261
|
+
query = QueryParams(ids='US1,US2')
|
|
262
|
+
assert query.ids == 'US1,US2'
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def test_query_params_ids_none():
|
|
266
|
+
query = QueryParams(ids=None)
|
|
267
|
+
assert query.ids is None
|
|
263
268
|
|
|
264
269
|
|
|
265
270
|
def test_user_query_rejects_ids_over_limit():
|
|
266
271
|
with pytest.raises(ValidationError):
|
|
267
|
-
UserQuery(ids=
|
|
272
|
+
UserQuery(ids=','.join(f'US{i}' for i in range(101)))
|
|
268
273
|
|
|
269
274
|
|
|
270
|
-
def
|
|
271
|
-
query = UserQuery(ids=
|
|
272
|
-
assert query.ids ==
|
|
275
|
+
def test_user_query_ids_empty_string_ok():
|
|
276
|
+
query = UserQuery(ids='')
|
|
277
|
+
assert query.ids == ''
|
|
273
278
|
assert 'ids' in query.model_dump(exclude_none=True)
|
|
274
279
|
|
|
275
280
|
|
|
File without changes
|
{cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{cuenca_validations-2.1.35.dev2.dist-info → cuenca_validations-2.1.36.dist-info}/top_level.txt
RENAMED
|
File without changes
|