Skip to content

Commit aac6c4b

Browse files
committed
Change Array.equals Any to Array and add tests
1 parent 3ddf085 commit aac6c4b

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎python/pyarrow-stubs/pyarrow/__lib/array.pyi‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Array(_PandasConvertible):
179179
) -> str: ...
180180

181181
format = to_string
182-
def equals(self, other: Array | Any) -> bool: ...
182+
def equals(self, other: Array) -> bool: ...
183183
def __len__(self) -> int: ...
184184
def is_null(self, *, nan_is_null: bool = False) -> BooleanArray: ...
185185
def is_nan(self) -> BooleanArray: ...

‎python/pyarrow-stubs/tests/test_array.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def test_array() -> None:
5151
lib.Array),
5252
lib.Int64Array)
5353

54+
other = check(cast(lib.StringArray, lib.array(["a", "b", None])), lib.StringArray)
55+
check(assert_type(arr.equals(arr), bool), bool)
56+
check(assert_type(arr.equals(other), bool), bool)
57+
5458

5559
def test_array_dlpack() -> None:
5660
arr = cast(lib.Int64Array, lib.array([1, 2]))
@@ -128,3 +132,5 @@ def test_invalid_usage() -> None:
128132
if TYPE_CHECKING_INVALID_USAGE:
129133
arr.cast(1) # type: ignore[arg-type]
130134
arr.slice("1") # type: ignore[arg-type]
135+
arr.equals(object()) # type: ignore[arg-type]
136+
arr.equals(None) # type: ignore[arg-type]

0 commit comments

Comments
 (0)