Skip to content

pandas 2.0 removals in testing and clipboard #933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 95 additions & 46 deletions pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,65 +1,117 @@
from collections.abc import Generator
from collections.abc import (
Container,
Generator,
Iterable,
)
from contextlib import contextmanager
from typing import (
Any,
Literal,
overload,
)
import warnings

from matplotlib.artist import Artist
import numpy as np
from pandas import (
Categorical,
DataFrame,
Index,
Series,
)
from pandas.arrays import (
DatetimeArray,
IntervalArray,
PeriodArray,
SparseArray,
TimedeltaArray,
)
from pandas.core.arrays.base import ExtensionArray

from pandas._typing import (
AnyArrayLike,
T,
)

def assert_almost_equal(
left,
right,
check_dtype: bool | str = ...,
check_less_precise: bool | int = ...,
left: T,
right: T,
check_dtype: bool | Literal["equiv"] = ...,
rtol: float = ...,
atol: float = ...,
**kwargs,
): ...
def assert_dict_equal(left, right, compare_keys: bool = ...): ...
def assert_index_equal(left: Index, right: Index) -> None: ...
def assert_class_equal(left, right, exact: bool | str = ..., obj=...): ...
def assert_attr_equal(attr, left, right, obj: str = ...): ...
def assert_is_valid_plot_return_object(objs) -> None: ...
def assert_is_sorted(seq) -> None: ...
) -> None: ...
def assert_dict_equal(left: dict, right: dict, compare_keys: bool = ...) -> None: ...
def assert_index_equal(
left: Index,
right: Index,
exact: bool | Literal["equiv"] = ...,
check_names: bool = ...,
check_exact: bool = ...,
check_categorical: bool = ...,
check_order: bool = ...,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
) -> None: ...
def assert_class_equal(
left: T, right: T, exact: bool | Literal["equiv"] = ..., obj: str = ...
) -> None: ...
def assert_attr_equal(
attr: str, left: object, right: object, obj: str = ...
) -> None: ...
def assert_is_valid_plot_return_object(
objs: Series | np.ndarray | Artist | tuple | dict,
) -> None: ...
def assert_is_sorted(seq: AnyArrayLike) -> None: ...
def assert_categorical_equal(
left,
right,
left: Categorical,
right: Categorical,
check_dtype: bool = ...,
check_category_order: bool = ...,
obj: str = ...,
) -> None: ...
def assert_interval_array_equal(
left, right, exact: str = ..., obj: str = ...
left: IntervalArray,
right: IntervalArray,
exact: bool | Literal["equiv"] = ...,
obj: str = ...,
) -> None: ...
def assert_period_array_equal(
left: PeriodArray, right: PeriodArray, obj: str = ...
) -> None: ...
def assert_datetime_array_equal(
left: DatetimeArray, right: DatetimeArray, check_freq: bool = ...
) -> None: ...
def assert_timedelta_array_equal(
left: TimedeltaArray, right: TimedeltaArray, check_freq: bool = ...
) -> None: ...
def assert_period_array_equal(left, right, obj: str = ...) -> None: ...
def assert_datetime_array_equal(left, right, obj: str = ...) -> None: ...
def assert_timedelta_array_equal(left, right, obj: str = ...) -> None: ...
def assert_numpy_array_equal(
left,
right,
strict_nan: bool = ...,
check_dtype: bool = ...,
err_msg=...,
check_same=...,
check_dtype: bool | Literal["equiv"] = ...,
err_msg: str | None = ...,
check_same: Literal["copy", "same"] | None = ...,
obj: str = ...,
): ...
index_values: Index | np.ndarray | None = ...,
) -> None: ...
def assert_extension_array_equal(
left,
right,
check_dtype: bool = ...,
check_less_precise: bool = ...,
left: ExtensionArray,
right: ExtensionArray,
check_dtype: bool | Literal["equiv"] = ...,
index_values: Index | np.ndarray | None = ...,
check_exact: bool = ...,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
) -> None: ...
@overload
def assert_series_equal(
left: Series,
right: Series,
check_dtype: bool = ...,
check_index_type: bool | str = ...,
check_dtype: bool | Literal["equiv"] = ...,
check_index_type: bool | Literal["equiv"] = ...,
check_series_type: bool = ...,
check_names: bool = ...,
check_exact: bool = ...,
Expand All @@ -79,8 +131,8 @@ def assert_series_equal(
def assert_series_equal(
left: Series,
right: Series,
check_dtype: bool = ...,
check_index_type: bool | str = ...,
check_dtype: bool | Literal["equiv"] = ...,
check_index_type: bool | Literal["equiv"] = ...,
check_series_type: bool = ...,
check_names: bool = ...,
check_exact: bool = ...,
Expand All @@ -103,37 +155,34 @@ def assert_frame_equal(
check_index_type: bool | Literal["equiv"] = ...,
check_column_type: bool | Literal["equiv"] = ...,
check_frame_type: bool = ...,
check_less_precise: int | bool = ...,
check_names: bool = ...,
by_blocks: bool = ...,
check_exact: bool = ...,
check_datetimelike_compat: bool = ...,
check_categorical: bool = ...,
check_like: bool = ...,
check_freq: bool = ...,
check_flag: bool = ...,
check_flags: bool = ...,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
) -> None: ...
def assert_equal(left, right, **kwargs) -> None: ...
def assert_sp_array_equal(
left,
right,
check_dtype: bool = ...,
check_kind: bool = ...,
check_fill_value: bool = ...,
consolidate_block_indices: bool = ...,
) -> None: ...
def assert_contains_all(iterable, dic) -> None: ...
def assert_copy(iter1, iter2, **eql_kwargs) -> None: ...
def assert_sp_array_equal(left: SparseArray, right: SparseArray) -> None: ...
def assert_contains_all(iterable: Iterable[T], dic: Container[T]) -> None: ...
def assert_copy(iter1: Iterable[T], iter2: Iterable[T], **eql_kwargs) -> None: ...
@contextmanager
def assert_produces_warning(
expected_warning=...,
filter_level: str = ...,
clear=...,
expected_warning: (
type[Warning] | Literal[False] | tuple[type[Warning], ...] | None
) = ...,
filter_level: Literal[
"error", "ignore", "always", "default", "module", "once"
] = ...,
check_stacklevel: bool = ...,
raise_on_extra_warnings: bool = ...,
) -> None: ...
match: str | None = None,
) -> Generator[list[warnings.WarningMessage], None, None]: ...
@contextmanager
def ensure_clean(
filename: str | None = ..., return_filelike: bool = ..., **kwargs: Any
Expand Down
6 changes: 0 additions & 6 deletions pandas-stubs/io/clipboards.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ def read_clipboard(
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect = ...,
# error_bad_lines: bool | None = ..., # Deprecated: 1.3.0
# warn_bad_lines: bool | None = ..., # Deprecated: 1.3.0
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
Expand Down Expand Up @@ -137,8 +135,6 @@ def read_clipboard(
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect = ...,
# error_bad_lines: bool | None = ..., # Deprecated: 1.3.0
# warn_bad_lines: bool | None = ..., # Deprecated: 1.3.0
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
Expand Down Expand Up @@ -198,8 +194,6 @@ def read_clipboard(
encoding: str | None = ...,
encoding_errors: str | None = ...,
dialect: str | csv.Dialect = ...,
# error_bad_lines: bool | None = ..., # Deprecated: 1.3.0
# warn_bad_lines: bool | None = ..., # Deprecated: 1.3.0
on_bad_lines: (
Literal["error", "warn", "skip"] | Callable[[list[str]], list[str] | None]
) = ...,
Expand Down
Loading