mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2025-01-09 05:34:27 +00:00
recursively validate tuples instead of simple containment checking
This commit is contained in:
parent
22341c8b06
commit
e942da4bec
1 changed files with 1 additions and 1 deletions
|
@ -32,7 +32,7 @@ def validate_dtype(dtype: Any, target: DtypeType) -> bool:
|
|||
return True
|
||||
|
||||
if isinstance(target, tuple):
|
||||
valid = dtype in target
|
||||
valid = any(validate_dtype(dtype, target_dt) for target_dt in target)
|
||||
elif is_union(target):
|
||||
valid = any(
|
||||
[validate_dtype(dtype, target_dt) for target_dt in get_args(target)]
|
||||
|
|
Loading…
Reference in a new issue