codekingpro/portable-devtools
114k
1from typing import Any, NamedTuple, assert_type
2
3import numpy as np
4
5# Subtype of tuple[int, int]
6class XYGrid(NamedTuple):
7 x_axis: int
8 y_axis: int
9
10arr: np.ndarray[XYGrid, Any]
11
12# Test shape property matches shape typevar
13assert_type(arr.shape, XYGrid)
14 