From e942da4becaba1c3c548ea864712cfce567506b9 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Fri, 13 Dec 2024 17:55:35 -0800 Subject: [PATCH] recursively validate tuples instead of simple containment checking --- src/numpydantic/validation/dtype.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/numpydantic/validation/dtype.py b/src/numpydantic/validation/dtype.py index 5eeb124..d9b2790 100644 --- a/src/numpydantic/validation/dtype.py +++ b/src/numpydantic/validation/dtype.py @@ -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)]