@@ -361,18 +361,23 @@ def deep_iterable(member_validator, iterable_validator=None):
361361 A validator that performs deep validation of an iterable.
362362
363363 Args:
364- member_validator: Validator to apply to iterable members.
364+ member_validator: Validator(s) to apply to iterable members.
365365
366- iterable_validator:
367- Validator to apply to iterable itself (optional).
366+ iterable_validator: Validator(s) to apply to iterable itself (optional).
368367
369368 Raises
370369 TypeError: if any sub-validators fail
371370
372371 .. versionadded:: 19.1.0
372+
373+ .. versionchanged:: 25.4.0
374+ *member_validator* and *iterable_validator* can now be a list or tuple
375+ of validators.
373376 """
374377 if isinstance (member_validator , (list , tuple )):
375378 member_validator = and_ (* member_validator )
379+ if isinstance (iterable_validator , (list , tuple )):
380+ iterable_validator = and_ (* iterable_validator )
376381 return _DeepIterable (member_validator , iterable_validator )
377382
378383
@@ -409,19 +414,23 @@ def deep_mapping(
409414 *value_validator* must be provided.
410415
411416 Args:
412- key_validator: Validator to apply to dictionary keys.
417+ key_validator: Validator(s) to apply to dictionary keys.
413418
414- value_validator: Validator to apply to dictionary values.
419+ value_validator: Validator(s) to apply to dictionary values.
415420
416421 mapping_validator:
417- Validator to apply to top-level mapping attribute.
422+ Validator(s) to apply to top-level mapping attribute.
418423
419424 .. versionadded:: 19.1.0
420425
421426 .. versionchanged:: 25.4.0
422427 *key_validator* and *value_validator* are now optional, but at least one
423428 of them must be provided.
424429
430+ .. versionchanged:: 25.4.0
431+ *key_validator*, *value_validator*, and *mapping_validator* can now be a
432+ list or tuple of validators.
433+
425434 Raises:
426435 TypeError: If any sub-validator fails on validation.
427436
@@ -435,6 +444,13 @@ def deep_mapping(
435444 )
436445 raise ValueError (msg )
437446
447+ if isinstance (key_validator , (list , tuple )):
448+ key_validator = and_ (* key_validator )
449+ if isinstance (value_validator , (list , tuple )):
450+ value_validator = and_ (* value_validator )
451+ if isinstance (mapping_validator , (list , tuple )):
452+ mapping_validator = and_ (* mapping_validator )
453+
438454 return _DeepMapping (key_validator , value_validator , mapping_validator )
439455
440456
0 commit comments