From 5d0ceb1ab2ea9ae0d406fb38ec7ff1e745d70ff8 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Sat, 11 Jan 2025 14:15:19 +0100 Subject: [PATCH] Update project and better numpy --- .pre-commit-config.yaml | 2 +- pyproject.toml | 2 +- requirements.txt | 12 +- stubs/geopandas-stubs/array.pyi | 114 ++++----- stubs/pandapower-stubs/groups.pyi | 4 +- stubs/pandapower-stubs/io_utils.pyi | 4 +- stubs/pandapower-stubs/toolbox.pyi | 2 +- tests/shapely/test_geometry.py | 54 ++--- tests/shapely/test_predicates.py | 359 ++++++++++++++-------------- 9 files changed, 270 insertions(+), 283 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d994cb..c797724 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: mixed-line-ending - id: check-case-conflict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.0 # must match requirements.txt + rev: v0.9.1 # must match requirements.txt hooks: - id: ruff - id: ruff-format diff --git a/pyproject.toml b/pyproject.toml index 4ed4d72..697d908 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "python-stubs" version = "0.0.0" -requires-python = ">=3.8" +requires-python = ">=3.9" [tool.ruff] line-length = 130 diff --git a/requirements.txt b/requirements.txt index 6205d21..3128b3a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ django-types==0.20.0 # via -r requirements.in djangorestframework-types==0.9.0 # via -r requirements.in -folium==0.19.3 +folium==0.19.4 # via -r requirements.in fonttools==4.55.3 # via matplotlib @@ -41,7 +41,7 @@ matplotlib==3.10.0 # via -r requirements.in mdurl==0.1.2 # via markdown-it-py -mypy==1.14.0 +mypy==1.14.1 # via -r requirements.in mypy-extensions==1.0.0 # via mypy @@ -70,15 +70,15 @@ pandas==2.2.3 # via geopandas pandas-stubs==2.2.3.241126 # via -r requirements.in -pillow==11.0.0 +pillow==11.1.0 # via matplotlib pluggy==1.5.0 # via pytest -pygments==2.18.0 +pygments==2.19.1 # via rich pyogrio==0.10.0 # via geopandas -pyparsing==3.2.0 +pyparsing==3.2.1 # via matplotlib pyproj==3.7.0 # via geopandas @@ -100,7 +100,7 @@ rich-argparse==1.6.0 # via -r requirements.in rtree==1.3.0 # via -r requirements.in -ruff==0.8.4 +ruff==0.9.1 # via -r requirements.in shapely==2.0.6 # via geopandas diff --git a/stubs/geopandas-stubs/array.pyi b/stubs/geopandas-stubs/array.pyi index 8c4e546..fe63e7d 100644 --- a/stubs/geopandas-stubs/array.pyi +++ b/stubs/geopandas-stubs/array.pyi @@ -1,7 +1,7 @@ import builtins from _typeshed import Incomplete, Unused from collections.abc import Callable, Sequence -from typing import Any, ClassVar, Literal, NoReturn, SupportsIndex, overload +from typing import Any, ClassVar, Literal, NoReturn, SupportsIndex, TypeVar, overload from typing_extensions import Self, TypeAlias, deprecated import numpy as np @@ -15,6 +15,8 @@ from shapely.geometry.base import BaseGeometry from geopandas.base import _AffinityOrigin, _ConvertibleToCRS from geopandas.sindex import SpatialIndex +_ScalarType = TypeVar("_ScalarType", bound=np.generic) +_Array1D: TypeAlias = np.ndarray[tuple[int], np.dtype[_ScalarType]] _ArrayOrGeom: TypeAlias = GeometryArray | ArrayLike | Geometry TransformerFromCRS = Transformer.from_crs @@ -30,18 +32,18 @@ class GeometryDtype(ExtensionDtype): def isna(value: object) -> bool: ... def from_shapely(data, crs: _ConvertibleToCRS | None = None) -> GeometryArray: ... -def to_shapely(geoms: GeometryArray) -> NDArray[np.object_]: ... +def to_shapely(geoms: GeometryArray) -> _Array1D[np.object_]: ... def from_wkb( data, crs: _ConvertibleToCRS | None = None, on_invalid: Literal["raise", "warn", "ignore"] = "raise" ) -> GeometryArray: ... @overload -def to_wkb(geoms: GeometryArray, hex: Literal[False] = False, **kwargs) -> NDArray[np.bytes_]: ... +def to_wkb(geoms: GeometryArray, hex: Literal[False] = False, **kwargs) -> _Array1D[np.bytes_]: ... @overload -def to_wkb(geoms: GeometryArray, hex: Literal[True], **kwargs) -> NDArray[np.str_]: ... +def to_wkb(geoms: GeometryArray, hex: Literal[True], **kwargs) -> _Array1D[np.str_]: ... def from_wkt( data, crs: _ConvertibleToCRS | None = None, on_invalid: Literal["raise", "warn", "ignore"] = "raise" ) -> GeometryArray: ... -def to_wkt(geoms: GeometryArray, **kwargs) -> NDArray[np.str_]: ... +def to_wkt(geoms: GeometryArray, **kwargs) -> _Array1D[np.str_]: ... def points_from_xy( x: ArrayLike, y: ArrayLike, z: ArrayLike | None = None, crs: _ConvertibleToCRS | None = None ) -> GeometryArray: ... @@ -64,44 +66,44 @@ class GeometryArray(ExtensionArray): def __getitem__(self, idx: int | np.integer[Any]) -> BaseGeometry: ... # Always 1-D, doesn't accept tuple @overload def __getitem__( - self, idx: slice | Sequence[SupportsIndex] | NDArray[np.bool_] | NDArray[np.integer[Any]] + self, idx: slice | Sequence[SupportsIndex] | NDArray[np.bool] | NDArray[np.integer[Any]] ) -> GeometryArray: ... @overload def __getitem__( - self, idx: int | np.integer[Any] | slice | Sequence[int] | NDArray[np.bool_] | NDArray[np.integer[Any]] + self, idx: int | np.integer[Any] | slice | Sequence[int] | NDArray[np.bool] | NDArray[np.integer[Any]] ) -> BaseGeometry | GeometryArray: ... def __setitem__(self, key, value: _ArrayOrGeom | pd.DataFrame | pd.Series[Any]) -> None: ... @property - def is_valid(self) -> NDArray[np.bool_]: ... - def is_valid_reason(self) -> NDArray[np.object_]: ... + def is_valid(self) -> _Array1D[np.bool]: ... + def is_valid_reason(self) -> _Array1D[np.object_]: ... @property - def is_empty(self) -> NDArray[np.bool_]: ... + def is_empty(self) -> _Array1D[np.bool]: ... @property - def is_simple(self) -> NDArray[np.bool_]: ... + def is_simple(self) -> _Array1D[np.bool]: ... @property - def is_ring(self) -> NDArray[np.bool_]: ... + def is_ring(self) -> _Array1D[np.bool]: ... @property - def is_closed(self) -> NDArray[np.bool_]: ... + def is_closed(self) -> _Array1D[np.bool]: ... @property - def is_ccw(self) -> NDArray[np.bool_]: ... + def is_ccw(self) -> _Array1D[np.bool]: ... @property - def has_z(self) -> NDArray[np.bool_]: ... + def has_z(self) -> _Array1D[np.bool]: ... @property - def geom_type(self) -> NDArray[np.int64]: ... + def geom_type(self) -> _Array1D[np.int64]: ... @property - def area(self) -> NDArray[np.float64]: ... + def area(self) -> _Array1D[np.float64]: ... @property - def length(self) -> NDArray[np.float64]: ... - def count_coordinates(self) -> NDArray[np.int64]: ... - def count_geometries(self) -> NDArray[np.int64]: ... - def count_interior_rings(self) -> NDArray[np.int64]: ... - def get_precision(self) -> NDArray[np.float64]: ... - def get_geometry(self, index: SupportsIndex | ArrayLike) -> NDArray[np.object_]: ... + def length(self) -> _Array1D[np.float64]: ... + def count_coordinates(self) -> _Array1D[np.int64]: ... + def count_geometries(self) -> _Array1D[np.int64]: ... + def count_interior_rings(self) -> _Array1D[np.int64]: ... + def get_precision(self) -> _Array1D[np.float64]: ... + def get_geometry(self, index: SupportsIndex | ArrayLike) -> _Array1D[np.object_]: ... @property def boundary(self) -> GeometryArray: ... @property def centroid(self) -> GeometryArray: ... - def concave_hull(self, ratio: float, allow_holes: bool) -> NDArray[np.object_]: ... + def concave_hull(self, ratio: float, allow_holes: bool) -> _Array1D[np.object_]: ... @property def convex_hull(self) -> GeometryArray: ... @property @@ -118,12 +120,12 @@ class GeometryArray(ExtensionArray): mitre_limit: float = 5.0, ) -> GeometryArray: ... @property - def interiors(self) -> NDArray[np.object_]: ... + def interiors(self) -> _Array1D[np.object_]: ... def remove_repeated_points(self, tolerance: float | ArrayLike = 0.0) -> GeometryArray: ... def representative_point(self) -> GeometryArray: ... def minimum_bounding_circle(self) -> GeometryArray: ... - def minimum_bounding_radius(self) -> NDArray[np.float64]: ... - def minimum_clearance(self) -> NDArray[np.float64]: ... + def minimum_bounding_radius(self) -> _Array1D[np.float64]: ... + def minimum_clearance(self) -> _Array1D[np.float64]: ... def normalize(self) -> GeometryArray: ... def make_valid(self) -> GeometryArray: ... def reverse(self) -> GeometryArray: ... @@ -137,21 +139,21 @@ class GeometryArray(ExtensionArray): def set_precision( self, grid_size: float, mode: Literal["valid_output", "pointwise", "keep_collapsed", 0, 1, 2] = "valid_output" ) -> GeometryArray: ... - def covers(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def covered_by(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def contains(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def contains_properly(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def crosses(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def disjoint(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def geom_equals(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def intersects(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def overlaps(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def touches(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def within(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ... - def dwithin(self, other: _ArrayOrGeom, distance: float) -> NDArray[np.bool_]: ... - def geom_equals_exact(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> NDArray[np.bool_]: ... + def covers(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def covered_by(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def contains(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def contains_properly(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def crosses(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def disjoint(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def geom_equals(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def intersects(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def overlaps(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def touches(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def within(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ... + def dwithin(self, other: _ArrayOrGeom, distance: float) -> _Array1D[np.bool]: ... + def geom_equals_exact(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> _Array1D[np.bool]: ... @deprecated("Use method `geom_equals_exact` instead.") - def geom_almost_equals(self, other: _ArrayOrGeom, decimal: float) -> NDArray[np.bool_]: ... + def geom_almost_equals(self, other: _ArrayOrGeom, decimal: float) -> _Array1D[np.bool]: ... def clip_by_rect(self, xmin: float, ymin: float, xmax: float, ymax: float) -> GeometryArray: ... def difference(self, other: _ArrayOrGeom) -> GeometryArray: ... def intersection(self, other: _ArrayOrGeom) -> GeometryArray: ... @@ -160,15 +162,15 @@ class GeometryArray(ExtensionArray): def shortest_line(self, other: _ArrayOrGeom) -> GeometryArray: ... def snap(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> GeometryArray: ... def shared_paths(self, other: _ArrayOrGeom) -> GeometryArray: ... - def distance(self, other: _ArrayOrGeom) -> NDArray[np.float64]: ... - def hausdorff_distance(self, other: _ArrayOrGeom, **kwargs: Any) -> NDArray[np.float64]: ... - def frechet_distance(self, other: _ArrayOrGeom, **kwargs) -> NDArray[np.float64]: ... + def distance(self, other: _ArrayOrGeom) -> _Array1D[np.float64]: ... + def hausdorff_distance(self, other: _ArrayOrGeom, **kwargs: Any) -> _Array1D[np.float64]: ... + def frechet_distance(self, other: _ArrayOrGeom, **kwargs) -> _Array1D[np.float64]: ... def buffer(self, distance: float | ArrayLike, resolution: int = 16, **kwargs) -> GeometryArray: ... def interpolate(self, distance, normalized: bool = False) -> GeometryArray: ... def simplify(self, tolerance: float | ArrayLike, preserve_topology: bool = True) -> GeometryArray: ... - def project(self, other: _ArrayOrGeom, normalized: bool = False) -> NDArray[np.float64]: ... - def relate(self, other: _ArrayOrGeom) -> NDArray[np.str_]: ... - def relate_pattern(self, other, pattern: str) -> NDArray[np.bool_]: ... + def project(self, other: _ArrayOrGeom, normalized: bool = False) -> _Array1D[np.float64]: ... + def relate(self, other: _ArrayOrGeom) -> _Array1D[np.str_]: ... + def relate_pattern(self, other, pattern: str) -> _Array1D[np.bool]: ... def unary_union(self) -> BaseGeometry: ... def union_all(self, method: Literal["coverage", "unary"] = "unary") -> BaseGeometry: ... def intersection_all(self) -> BaseGeometry: ... @@ -184,15 +186,15 @@ class GeometryArray(ExtensionArray): def to_crs(self, crs: _ConvertibleToCRS | None = None, epsg: int | None = None) -> GeometryArray: ... def estimate_utm_crs(self, datum_name: str = "WGS 84") -> CRS: ... @property - def x(self) -> NDArray[np.float64]: ... + def x(self) -> _Array1D[np.float64]: ... @property - def y(self) -> NDArray[np.float64]: ... + def y(self) -> _Array1D[np.float64]: ... @property - def z(self) -> NDArray[np.float64]: ... + def z(self) -> _Array1D[np.float64]: ... @property - def bounds(self) -> NDArray[np.float64]: ... + def bounds(self) -> _Array1D[np.float64]: ... @property - def total_bounds(self) -> NDArray[np.float64]: ... + def total_bounds(self) -> _Array1D[np.float64]: ... @property def size(self) -> int: ... @property @@ -214,7 +216,7 @@ class GeometryArray(ExtensionArray): copy: bool = True, ) -> GeometryArray: ... def astype(self, dtype: DTypeLike, copy: bool = True) -> GeometryArray | ExtensionArray | NDArray[Any]: ... - def isna(self) -> NDArray[np.bool_]: ... + def isna(self) -> _Array1D[np.bool]: ... def value_counts(self, dropna: bool = True) -> pd.Series[int]: ... def unique(self) -> GeometryArray: ... @property @@ -222,9 +224,9 @@ class GeometryArray(ExtensionArray): def shift(self, periods: int = 1, fill_value: Geometry | None = None) -> GeometryArray: ... # type: ignore[override] def argmin(self, skipna: bool = True) -> NoReturn: ... def argmax(self, skipna: bool = True) -> NoReturn: ... - def __array__(self, dtype: DTypeLike | None = None, copy: bool | None = None) -> NDArray[np.object_]: ... - def __eq__(self, other: object) -> NDArray[np.bool_]: ... # type: ignore[override] - def __ne__(self, other: object) -> NDArray[np.bool_]: ... # type: ignore[override] + def __array__(self, dtype: DTypeLike | None = None, copy: bool | None = None) -> _Array1D[np.object_]: ... + def __eq__(self, other: object) -> _Array1D[np.bool]: ... # type: ignore[override] + def __ne__(self, other: object) -> _Array1D[np.bool]: ... # type: ignore[override] def __contains__(self, item: object) -> bool: ... def transform( diff --git a/stubs/pandapower-stubs/groups.pyi b/stubs/pandapower-stubs/groups.pyi index eb515c8..3fedb26 100644 --- a/stubs/pandapower-stubs/groups.pyi +++ b/stubs/pandapower-stubs/groups.pyi @@ -39,7 +39,7 @@ def isin_group( element_index: int | Iterable[int], index: int | Iterable[int] | None = None, drop_empty_lines: bool = True, -) -> bool | NDArray[np.bool_]: ... +) -> bool | NDArray[np.bool]: ... def element_associated_groups( net: pandapowerNet, element_type: str, element_index: Incomplete, return_empties: bool = True, drop_empty_lines: bool = True ) -> dict[int, list[int]]: ... @@ -49,7 +49,7 @@ def compare_group_elements(net: pandapowerNet, index1: int, index2: int) -> bool def check_unique_group_rows(net: pandapowerNet, raise_error: bool = True, log_level: str = "warning") -> None: ... def remove_not_existing_group_members(net: pandapowerNet, verbose: bool = True) -> None: ... def ensure_lists_in_group_element_column(net: pandapowerNet, drop_empty_lines: bool = True) -> None: ... -def group_entries_exist_in_element_table(net: pandapowerNet, index: int, element_type: str) -> NDArray[np.bool_]: ... +def group_entries_exist_in_element_table(net: pandapowerNet, index: int, element_type: str) -> NDArray[np.bool]: ... def set_group_in_service(net: pandapowerNet, index: int) -> None: ... def set_group_out_of_service(net: pandapowerNet, index: int) -> None: ... def set_value_to_group( diff --git a/stubs/pandapower-stubs/io_utils.pyi b/stubs/pandapower-stubs/io_utils.pyi index a5d4427..3eb4d3a 100644 --- a/stubs/pandapower-stubs/io_utils.pyi +++ b/stubs/pandapower-stubs/io_utils.pyi @@ -140,8 +140,8 @@ def to_serializable(obj: object) -> Incomplete: ... # def json_npint(obj: np.integer[Any]) -> dict[str, Incomplete]: ... # @to_serializable.register(np.floating) # def json_npfloat(obj: np.floating[Any]) -> dict[str, Incomplete]: ... -# @to_serializable.register(np.bool_) -# def json_npbool(obj: np.bool_) -> dict[str, Incomplete]: ... +# @to_serializable.register(np.bool) +# def json_npbool(obj: np.bool) -> dict[str, Incomplete]: ... # @to_serializable.register(numbers.Number) # def json_num(obj: numbers.Number) -> str: ... # @to_serializable.register(complex) diff --git a/stubs/pandapower-stubs/toolbox.pyi b/stubs/pandapower-stubs/toolbox.pyi index d7e5824..d076b46 100644 --- a/stubs/pandapower-stubs/toolbox.pyi +++ b/stubs/pandapower-stubs/toolbox.pyi @@ -69,7 +69,7 @@ def cosphi_from_pq( tuple[float, float, _PMode, _QMode] | tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.str_], NDArray[np.str_]] ): ... def dataframes_equal(df1: pd.DataFrame, df2: pd.DataFrame, ignore_index_order: bool = True, **kwargs: Incomplete) -> bool: ... -def compare_arrays(x: NDArray[Any], y: NDArray[Any]) -> NDArray[np.bool_]: ... +def compare_arrays(x: NDArray[Any], y: NDArray[Any]) -> NDArray[np.bool]: ... def log_to_level(msg: object, passed_logger: Logger, level: str) -> None: ... def lf_info(net: pandapowerNet, numv: int = 1, numi: int = 1) -> None: ... def opf_task( diff --git a/tests/shapely/test_geometry.py b/tests/shapely/test_geometry.py index 326fa43..aa1c0f5 100644 --- a/tests/shapely/test_geometry.py +++ b/tests/shapely/test_geometry.py @@ -146,69 +146,61 @@ def test_geometry_binary_predicates() -> None: check(assert_type(BG.relate([P, None]), NDArray[np.str_]), np.ndarray, dtype=str) check(assert_type(BG.covers(P), bool), bool) check(assert_type(BG.covers(None), bool), bool) - check(assert_type(BG.covers([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.covers([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.covered_by(P), bool), bool) check(assert_type(BG.covered_by(None), bool), bool) - check(assert_type(BG.covered_by([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.covered_by([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.contains(P), bool), bool) check(assert_type(BG.contains(None), bool), bool) - check(assert_type(BG.contains([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.contains([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.contains_properly(P), bool), bool) check(assert_type(BG.contains_properly(None), bool), bool) - check( - assert_type(BG.contains_properly([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_ - ) + check(assert_type(BG.contains_properly([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.crosses(P), bool), bool) check(assert_type(BG.crosses(None), bool), bool) - check(assert_type(BG.crosses([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.crosses([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.disjoint(P), bool), bool) check(assert_type(BG.disjoint(None), bool), bool) - check(assert_type(BG.disjoint([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.disjoint([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.equals(P), bool), bool) check(assert_type(BG.equals(None), bool), bool) - check(assert_type(BG.equals([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.equals([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.intersects(P), bool), bool) check(assert_type(BG.intersects(None), bool), bool) - check(assert_type(BG.intersects([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.intersects([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.overlaps(P), bool), bool) check(assert_type(BG.overlaps(None), bool), bool) - check(assert_type(BG.overlaps([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.overlaps([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.touches(P), bool), bool) check(assert_type(BG.touches(None), bool), bool) - check(assert_type(BG.touches([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.touches([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.within(P), bool), bool) check(assert_type(BG.within(None), bool), bool) - check(assert_type(BG.within([P, None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.within([P, None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.dwithin(P, 1.5), bool), bool) check(assert_type(BG.dwithin(None, 1.5), bool), bool) - check(assert_type(BG.dwithin([P, None], 1.5), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(BG.dwithin(P, [1.5]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(BG.dwithin(None, [1.5]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(BG.dwithin([P, None], [1.5]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(BG.dwithin([P, None], 1.5), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(BG.dwithin(P, [1.5]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(BG.dwithin(None, [1.5]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(BG.dwithin([P, None], [1.5]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check(assert_type(BG.equals_exact(P, 1.5), bool), bool) check(assert_type(BG.equals_exact(None, 1.5), bool), bool) + check(assert_type(BG.equals_exact([P, None], 1.5), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(BG.equals_exact(P, [1.5]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(BG.equals_exact(None, [1.5]), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(BG.equals_exact([P, None], 1.5), NDArray[np.bool_]), np.ndarray, dtype=np.bool_ - ) - check(assert_type(BG.equals_exact(P, [1.5]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(BG.equals_exact(None, [1.5]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check( - assert_type(BG.equals_exact([P, None], [1.5]), NDArray[np.bool_]), - np.ndarray, - dtype=np.bool_, + assert_type(BG.equals_exact([P, None], [1.5]), NDArray[np.bool]), np.ndarray, dtype=np.bool ) with pytest.warns(FutureWarning): - check(assert_type(BG.almost_equals(P, 1), bool | NDArray[np.bool_]), bool) # pyright: ignore[reportDeprecated] + check(assert_type(BG.almost_equals(P, 1), bool | NDArray[np.bool]), bool) # pyright: ignore[reportDeprecated] with pytest.warns(FutureWarning): - check(assert_type(BG.almost_equals(None, 1), bool | NDArray[np.bool_]), bool) # pyright: ignore[reportDeprecated] + check(assert_type(BG.almost_equals(None, 1), bool | NDArray[np.bool]), bool) # pyright: ignore[reportDeprecated] with pytest.warns(FutureWarning): - check(assert_type(BG.almost_equals([P, None], 1), bool | NDArray[np.bool_]), np.ndarray) # pyright: ignore[reportDeprecated] + check(assert_type(BG.almost_equals([P, None], 1), bool | NDArray[np.bool]), np.ndarray) # pyright: ignore[reportDeprecated] p = "T*F**F***" check(assert_type(BG.relate_pattern(P, p), bool), bool) check(assert_type(BG.relate_pattern(None, p), bool), bool) - check( - assert_type(BG.relate_pattern([P, None], p), NDArray[np.bool_]), np.ndarray, dtype=np.bool_ - ) + check(assert_type(BG.relate_pattern([P, None], p), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_geometry_linear_referencing() -> None: diff --git a/tests/shapely/test_predicates.py b/tests/shapely/test_predicates.py index 4bb6ff3..ebf3d2a 100644 --- a/tests/shapely/test_predicates.py +++ b/tests/shapely/test_predicates.py @@ -18,38 +18,38 @@ def test_has_z() -> None: - check(assert_type(shapely.has_z(P), bool), np.bool_) - check(assert_type(shapely.has_z(None), bool), np.bool_) - check(assert_type(shapely.has_z([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.has_z([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.has_z(P), bool), np.bool) + check(assert_type(shapely.has_z(None), bool), np.bool) + check(assert_type(shapely.has_z([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.has_z([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_ccw() -> None: - check(assert_type(shapely.is_ccw(P), bool), np.bool_) - check(assert_type(shapely.is_ccw(None), bool), np.bool_) - check(assert_type(shapely.is_ccw([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_ccw([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_ccw(P), bool), np.bool) + check(assert_type(shapely.is_ccw(None), bool), np.bool) + check(assert_type(shapely.is_ccw([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_ccw([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_closed() -> None: - check(assert_type(shapely.is_closed(P), bool), np.bool_) - check(assert_type(shapely.is_closed(None), bool), np.bool_) - check(assert_type(shapely.is_closed([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_closed([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_closed(P), bool), np.bool) + check(assert_type(shapely.is_closed(None), bool), np.bool) + check(assert_type(shapely.is_closed([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_closed([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_empty() -> None: - check(assert_type(shapely.is_empty(P), bool), np.bool_) - check(assert_type(shapely.is_empty(None), bool), np.bool_) - check(assert_type(shapely.is_empty([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_empty([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_empty(P), bool), np.bool) + check(assert_type(shapely.is_empty(None), bool), np.bool) + check(assert_type(shapely.is_empty([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_empty([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_geometry() -> None: - check(assert_type(shapely.is_geometry(P), Literal[True]), np.bool_) - check(assert_type(shapely.is_geometry(None), bool), np.bool_) - check(assert_type(shapely.is_geometry([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_geometry([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_geometry(P), Literal[True]), np.bool) + check(assert_type(shapely.is_geometry(None), bool), np.bool) + check(assert_type(shapely.is_geometry([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_geometry([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) x: Geometry | str | None = (shapely.from_wkt(P.wkt), "string", None)[min(1, 0)] if shapely.is_geometry(x): @@ -57,10 +57,10 @@ def test_is_geometry() -> None: def test_is_missing() -> None: - check(assert_type(shapely.is_missing(P), Literal[True]), np.bool_) - check(assert_type(shapely.is_missing(None), bool), np.bool_) - check(assert_type(shapely.is_missing([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_missing([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_missing(P), Literal[True]), np.bool) + check(assert_type(shapely.is_missing(None), bool), np.bool) + check(assert_type(shapely.is_missing([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_missing([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) x: Geometry | str | None = (shapely.from_wkt(P.wkt), "string", None)[min(1, 0)] if shapely.is_missing(x): @@ -68,19 +68,17 @@ def test_is_missing() -> None: def test_is_prepared() -> None: - check(assert_type(shapely.is_prepared(P), bool), np.bool_) - check(assert_type(shapely.is_prepared(None), bool), np.bool_) - check(assert_type(shapely.is_prepared([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_prepared([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_prepared(P), bool), np.bool) + check(assert_type(shapely.is_prepared(None), bool), np.bool) + check(assert_type(shapely.is_prepared([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_prepared([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_valid_input() -> None: - check(assert_type(shapely.is_valid_input(P), Literal[True]), np.bool_) - check(assert_type(shapely.is_valid_input(None), Literal[True]), np.bool_) - check(assert_type(shapely.is_valid_input([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check( - assert_type(shapely.is_valid_input([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_ - ) + check(assert_type(shapely.is_valid_input(P), Literal[True]), np.bool) + check(assert_type(shapely.is_valid_input(None), Literal[True]), np.bool) + check(assert_type(shapely.is_valid_input([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_valid_input([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) x: Geometry | str | None = (shapely.from_wkt(P.wkt), "string", None)[min(1, 0)] if shapely.is_valid_input(x): @@ -88,24 +86,24 @@ def test_is_valid_input() -> None: def test_is_ring() -> None: - check(assert_type(shapely.is_ring(P), bool), np.bool_) - check(assert_type(shapely.is_ring(None), bool), np.bool_) - check(assert_type(shapely.is_ring([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_ring([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_ring(P), bool), np.bool) + check(assert_type(shapely.is_ring(None), bool), np.bool) + check(assert_type(shapely.is_ring([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_ring([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_simple() -> None: - check(assert_type(shapely.is_simple(P), bool), np.bool_) - check(assert_type(shapely.is_simple(None), bool), np.bool_) - check(assert_type(shapely.is_simple([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_simple([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_simple(P), bool), np.bool) + check(assert_type(shapely.is_simple(None), bool), np.bool) + check(assert_type(shapely.is_simple([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_simple([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_valid() -> None: - check(assert_type(shapely.is_valid(P), bool), np.bool_) - check(assert_type(shapely.is_valid(None), bool), np.bool_) - check(assert_type(shapely.is_valid([P]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) - check(assert_type(shapely.is_valid([None]), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.is_valid(P), bool), np.bool) + check(assert_type(shapely.is_valid(None), bool), np.bool) + check(assert_type(shapely.is_valid([P]), NDArray[np.bool]), np.ndarray, dtype=np.bool) + check(assert_type(shapely.is_valid([None]), NDArray[np.bool]), np.ndarray, dtype=np.bool) def test_is_valid_reason() -> None: @@ -120,181 +118,179 @@ def test_is_valid_reason() -> None: def test_crosses() -> None: - check(assert_type(shapely.crosses(PO, P), bool), np.bool_) - check(assert_type(shapely.crosses(P, None), bool), np.bool_) - check(assert_type(shapely.crosses(None, None), bool), np.bool_) - check(assert_type(shapely.crosses([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.crosses(PO, P), bool), np.bool) + check(assert_type(shapely.crosses(P, None), bool), np.bool) + check(assert_type(shapely.crosses(None, None), bool), np.bool) + check(assert_type(shapely.crosses([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.crosses([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.crosses([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_contains() -> None: - check(assert_type(shapely.contains(PO, P), bool), np.bool_) - check(assert_type(shapely.contains(P, None), bool), np.bool_) - check(assert_type(shapely.contains(None, None), bool), np.bool_) - check(assert_type(shapely.contains([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.contains(PO, P), bool), np.bool) + check(assert_type(shapely.contains(P, None), bool), np.bool) + check(assert_type(shapely.contains(None, None), bool), np.bool) + check(assert_type(shapely.contains([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.contains([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.contains([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_contains_properly() -> None: - check(assert_type(shapely.contains_properly(PO, P), bool), np.bool_) - check(assert_type(shapely.contains_properly(P, None), bool), np.bool_) - check(assert_type(shapely.contains_properly(None, None), bool), np.bool_) + check(assert_type(shapely.contains_properly(PO, P), bool), np.bool) + check(assert_type(shapely.contains_properly(P, None), bool), np.bool) + check(assert_type(shapely.contains_properly(None, None), bool), np.bool) check( - assert_type(shapely.contains_properly([P], None), NDArray[np.bool_]), + assert_type(shapely.contains_properly([P], None), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.contains_properly([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.contains_properly([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_covered_by() -> None: - check(assert_type(shapely.covered_by(PO, P), bool), np.bool_) - check(assert_type(shapely.covered_by(P, None), bool), np.bool_) - check(assert_type(shapely.covered_by(None, None), bool), np.bool_) - check(assert_type(shapely.covered_by([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.covered_by(PO, P), bool), np.bool) + check(assert_type(shapely.covered_by(P, None), bool), np.bool) + check(assert_type(shapely.covered_by(None, None), bool), np.bool) + check(assert_type(shapely.covered_by([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.covered_by([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.covered_by([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_covers() -> None: - check(assert_type(shapely.covers(PO, P), bool), np.bool_) - check(assert_type(shapely.covers(P, None), bool), np.bool_) - check(assert_type(shapely.covers(None, None), bool), np.bool_) - check(assert_type(shapely.covers([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.covers(PO, P), bool), np.bool) + check(assert_type(shapely.covers(P, None), bool), np.bool) + check(assert_type(shapely.covers(None, None), bool), np.bool) + check(assert_type(shapely.covers([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.covers([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.covers([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_disjoint() -> None: - check(assert_type(shapely.disjoint(PO, P), bool), np.bool_) - check(assert_type(shapely.disjoint(P, None), bool), np.bool_) - check(assert_type(shapely.disjoint(None, None), bool), np.bool_) - check(assert_type(shapely.disjoint([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.disjoint(PO, P), bool), np.bool) + check(assert_type(shapely.disjoint(P, None), bool), np.bool) + check(assert_type(shapely.disjoint(None, None), bool), np.bool) + check(assert_type(shapely.disjoint([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.disjoint([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.disjoint([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_equals() -> None: - check(assert_type(shapely.equals(PO, P), bool), np.bool_) - check(assert_type(shapely.equals(P, None), bool), np.bool_) - check(assert_type(shapely.equals(None, None), bool), np.bool_) - check(assert_type(shapely.equals([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.equals(PO, P), bool), np.bool) + check(assert_type(shapely.equals(P, None), bool), np.bool) + check(assert_type(shapely.equals(None, None), bool), np.bool) + check(assert_type(shapely.equals([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.equals([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.equals([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_intersects() -> None: - check(assert_type(shapely.intersects(PO, P), bool), np.bool_) - check(assert_type(shapely.intersects(P, None), bool), np.bool_) - check(assert_type(shapely.intersects(None, None), bool), np.bool_) - check(assert_type(shapely.intersects([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.intersects(PO, P), bool), np.bool) + check(assert_type(shapely.intersects(P, None), bool), np.bool) + check(assert_type(shapely.intersects(None, None), bool), np.bool) + check(assert_type(shapely.intersects([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.intersects([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.intersects([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_overlaps() -> None: - check(assert_type(shapely.overlaps(PO, P), bool), np.bool_) - check(assert_type(shapely.overlaps(P, None), bool), np.bool_) - check(assert_type(shapely.overlaps(None, None), bool), np.bool_) - check(assert_type(shapely.overlaps([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.overlaps(PO, P), bool), np.bool) + check(assert_type(shapely.overlaps(P, None), bool), np.bool) + check(assert_type(shapely.overlaps(None, None), bool), np.bool) + check(assert_type(shapely.overlaps([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.overlaps([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.overlaps([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_touches() -> None: - check(assert_type(shapely.touches(PO, P), bool), np.bool_) - check(assert_type(shapely.touches(P, None), bool), np.bool_) - check(assert_type(shapely.touches(None, None), bool), np.bool_) - check(assert_type(shapely.touches([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.touches(PO, P), bool), np.bool) + check(assert_type(shapely.touches(P, None), bool), np.bool) + check(assert_type(shapely.touches(None, None), bool), np.bool) + check(assert_type(shapely.touches([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.touches([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.touches([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_within() -> None: - check(assert_type(shapely.within(PO, P), bool), np.bool_) - check(assert_type(shapely.within(P, None), bool), np.bool_) - check(assert_type(shapely.within(None, None), bool), np.bool_) - check(assert_type(shapely.within([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_) + check(assert_type(shapely.within(PO, P), bool), np.bool) + check(assert_type(shapely.within(P, None), bool), np.bool) + check(assert_type(shapely.within(None, None), bool), np.bool) + check(assert_type(shapely.within([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.within([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.within([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_equals_exact() -> None: - check(assert_type(shapely.equals_exact(PO, P), bool), np.bool_) - check(assert_type(shapely.equals_exact(P, None), bool), np.bool_) - check(assert_type(shapely.equals_exact(None, None), bool), np.bool_) + check(assert_type(shapely.equals_exact(PO, P), bool), np.bool) + check(assert_type(shapely.equals_exact(P, None), bool), np.bool) + check(assert_type(shapely.equals_exact(None, None), bool), np.bool) + check(assert_type(shapely.equals_exact([P], None), NDArray[np.bool]), np.ndarray, dtype=np.bool) check( - assert_type(shapely.equals_exact([P], None), NDArray[np.bool_]), np.ndarray, dtype=np.bool_ - ) - check( - assert_type(shapely.equals_exact([PO, P, None], [PO2, None, None]), NDArray[np.bool_]), + assert_type(shapely.equals_exact([PO, P, None], [PO2, None, None]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.equals_exact(PO, P, tolerance=[0.01, 1]), NDArray[np.bool_]), + assert_type(shapely.equals_exact(PO, P, tolerance=[0.01, 1]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.equals_exact(P, None, tolerance=[0.01, 1]), NDArray[np.bool_]), + assert_type(shapely.equals_exact(P, None, tolerance=[0.01, 1]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.equals_exact(None, None, tolerance=[0.01, 1]), NDArray[np.bool_]), + assert_type(shapely.equals_exact(None, None, tolerance=[0.01, 1]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.equals_exact([P], None, tolerance=[0.01, 1]), NDArray[np.bool_]), + assert_type(shapely.equals_exact([P], None, tolerance=[0.01, 1]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( shapely.equals_exact([PO, P, None], [PO2, None, None], tolerance=[0.01, 1, 0.5]), - NDArray[np.bool_], + NDArray[np.bool], ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) @@ -311,138 +307,135 @@ def test_relate() -> None: def test_relate_pattern() -> None: - check(assert_type(shapely.relate_pattern(PO, P, pattern="T*F**F***"), bool), np.bool_) - check(assert_type(shapely.relate_pattern(P, None, pattern="T*F**F***"), bool), np.bool_) - check(assert_type(shapely.relate_pattern(None, None, pattern="T*F**F***"), bool), np.bool_) + check(assert_type(shapely.relate_pattern(PO, P, pattern="T*F**F***"), bool), np.bool) + check(assert_type(shapely.relate_pattern(P, None, pattern="T*F**F***"), bool), np.bool) + check(assert_type(shapely.relate_pattern(None, None, pattern="T*F**F***"), bool), np.bool) check( - assert_type(shapely.relate_pattern([P], None, pattern="T*F**F***"), NDArray[np.bool_]), + assert_type(shapely.relate_pattern([P], None, pattern="T*F**F***"), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( shapely.relate_pattern([PO, P, None], [PO2, None, None], pattern="T*F**F***"), - NDArray[np.bool_], + NDArray[np.bool], ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_dwithin() -> None: - check(assert_type(shapely.dwithin(PO, P, distance=0.01), bool), np.bool_) - check(assert_type(shapely.dwithin(P, None, distance=0.01), bool), np.bool_) - check(assert_type(shapely.dwithin(None, None, distance=0.01), bool), np.bool_) + check(assert_type(shapely.dwithin(PO, P, distance=0.01), bool), np.bool) + check(assert_type(shapely.dwithin(P, None, distance=0.01), bool), np.bool) + check(assert_type(shapely.dwithin(None, None, distance=0.01), bool), np.bool) check( - assert_type(shapely.dwithin([P], None, distance=0.01), NDArray[np.bool_]), + assert_type(shapely.dwithin([P], None, distance=0.01), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( - shapely.dwithin([PO, P, None], [PO2, None, None], distance=0.01), NDArray[np.bool_] + shapely.dwithin([PO, P, None], [PO2, None, None], distance=0.01), NDArray[np.bool] ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_contains_xy() -> None: - check(assert_type(shapely.contains_xy(PO, 0.5, 0.5), bool), np.bool_) - check(assert_type(shapely.contains_xy(None, 0.5, 0.5), bool), np.bool_) + check(assert_type(shapely.contains_xy(PO, 0.5, 0.5), bool), np.bool) + check(assert_type(shapely.contains_xy(None, 0.5, 0.5), bool), np.bool) check( - assert_type(shapely.contains_xy(PO, [0.5], [0.5]), NDArray[np.bool_]), + assert_type(shapely.contains_xy(PO, [0.5], [0.5]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.contains_xy(PO, [0.5], 0.5), NDArray[np.bool_]), + assert_type(shapely.contains_xy(PO, [0.5], 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.contains_xy(PO, [[0.5, 0.5]]), NDArray[np.bool_]), + assert_type(shapely.contains_xy(PO, [[0.5, 0.5]]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.contains_xy([P], 0.5, 0.5), NDArray[np.bool_]), - np.ndarray, - dtype=np.bool_, + assert_type(shapely.contains_xy([P], 0.5, 0.5), NDArray[np.bool]), np.ndarray, dtype=np.bool ) check( - assert_type(shapely.contains_xy([None], 0.5, 0.5), NDArray[np.bool_]), + assert_type(shapely.contains_xy([None], 0.5, 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.contains_xy([P, None], 0.5, 0.5), NDArray[np.bool_]), + assert_type(shapely.contains_xy([P, None], 0.5, 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( - shapely.contains_xy([PO, P, None], [0.5, 0.4, 0.3], [0.5, 0.4, 0.3]), NDArray[np.bool_] + shapely.contains_xy([PO, P, None], [0.5, 0.4, 0.3], [0.5, 0.4, 0.3]), NDArray[np.bool] ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( shapely.contains_xy([PO, P, None], [(0.5, 0.5), (0.4, 0.4), (0.3, 0.3)]), - NDArray[np.bool_], + NDArray[np.bool], ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) def test_intersects_xy() -> None: - check(assert_type(shapely.intersects_xy(PO, 0.5, 0.5), bool), np.bool_) - check(assert_type(shapely.intersects_xy(None, 0.5, 0.5), bool), np.bool_) + check(assert_type(shapely.intersects_xy(PO, 0.5, 0.5), bool), np.bool) + check(assert_type(shapely.intersects_xy(None, 0.5, 0.5), bool), np.bool) check( - assert_type(shapely.intersects_xy(PO, [0.5], [0.5]), NDArray[np.bool_]), + assert_type(shapely.intersects_xy(PO, [0.5], [0.5]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.intersects_xy(PO, [0.5], 0.5), NDArray[np.bool_]), + assert_type(shapely.intersects_xy(PO, [0.5], 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.intersects_xy(PO, [[0.5, 0.5]]), NDArray[np.bool_]), + assert_type(shapely.intersects_xy(PO, [[0.5, 0.5]]), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.intersects_xy([P], 0.5, 0.5), NDArray[np.bool_]), + assert_type(shapely.intersects_xy([P], 0.5, 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.intersects_xy([None], 0.5, 0.5), NDArray[np.bool_]), + assert_type(shapely.intersects_xy([None], 0.5, 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( - assert_type(shapely.intersects_xy([P, None], 0.5, 0.5), NDArray[np.bool_]), + assert_type(shapely.intersects_xy([P, None], 0.5, 0.5), NDArray[np.bool]), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( - shapely.intersects_xy([PO, P, None], [0.5, 0.4, 0.3], [0.5, 0.4, 0.3]), - NDArray[np.bool_], + shapely.intersects_xy([PO, P, None], [0.5, 0.4, 0.3], [0.5, 0.4, 0.3]), NDArray[np.bool] ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, ) check( assert_type( shapely.intersects_xy([PO, P, None], [(0.5, 0.5), (0.4, 0.4), (0.3, 0.3)]), - NDArray[np.bool_], + NDArray[np.bool], ), np.ndarray, - dtype=np.bool_, + dtype=np.bool, )