[ty] Fix property-tests (#22229)

This commit is contained in:
Micha Reiser
2025-12-28 09:58:48 +01:00
committed by GitHub
parent dea48ecef0
commit d5c39d3f9f
2 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
# Tuple pair is assignable to their union
Regression test for <https://github.com/astral-sh/ty/issues/2236>.
```toml
[environment]
python-version = "3.11"
```
```py
from types import FunctionType
from ty_extensions import Not, AlwaysTruthy, is_subtype_of, static_assert, is_disjoint_from
class Meta(type): ...
class F(metaclass=Meta): ...
static_assert(not is_subtype_of(tuple[FunctionType, type[F]], Not[tuple[*tuple[AlwaysTruthy, ...], Meta]]))
static_assert(not is_subtype_of(Not[tuple[*tuple[AlwaysTruthy, ...], Meta]], tuple[FunctionType, type[F]]))
static_assert(is_disjoint_from(tuple[FunctionType, type[F]], Not[tuple[*tuple[AlwaysTruthy, ...], Meta]]))
```