1
- from collections .abc import Generator
1
+ from collections .abc import (
2
+ Container ,
3
+ Generator ,
4
+ Iterable ,
5
+ )
2
6
from contextlib import contextmanager
3
7
from typing import (
4
8
Any ,
5
9
Literal ,
6
10
overload ,
7
11
)
12
+ import warnings
8
13
14
+ from matplotlib .artist import Artist
15
+ import numpy as np
9
16
from pandas import (
17
+ Categorical ,
10
18
DataFrame ,
11
19
Index ,
12
20
Series ,
13
21
)
22
+ from pandas .arrays import (
23
+ DatetimeArray ,
24
+ IntervalArray ,
25
+ PeriodArray ,
26
+ SparseArray ,
27
+ TimedeltaArray ,
28
+ )
29
+ from pandas .core .arrays .base import ExtensionArray
30
+
31
+ from pandas ._typing import (
32
+ AnyArrayLike ,
33
+ T ,
34
+ )
14
35
15
36
def assert_almost_equal (
16
- left ,
17
- right ,
18
- check_dtype : bool | str = ...,
19
- check_less_precise : bool | int = ...,
37
+ left : T ,
38
+ right : T ,
39
+ check_dtype : bool | Literal ["equiv" ] = ...,
40
+ rtol : float = ...,
41
+ atol : float = ...,
20
42
** kwargs ,
21
- ): ...
22
- def assert_dict_equal (left , right , compare_keys : bool = ...): ...
23
- def assert_index_equal (left : Index , right : Index ) -> None : ...
24
- def assert_class_equal (left , right , exact : bool | str = ..., obj = ...): ...
25
- def assert_attr_equal (attr , left , right , obj : str = ...): ...
26
- def assert_is_valid_plot_return_object (objs ) -> None : ...
27
- def assert_is_sorted (seq ) -> None : ...
43
+ ) -> None : ...
44
+ def assert_dict_equal (left : dict , right : dict , compare_keys : bool = ...) -> None : ...
45
+ def assert_index_equal (
46
+ left : Index ,
47
+ right : Index ,
48
+ exact : bool | Literal ["equiv" ] = ...,
49
+ check_names : bool = ...,
50
+ check_exact : bool = ...,
51
+ check_categorical : bool = ...,
52
+ check_order : bool = ...,
53
+ rtol : float = ...,
54
+ atol : float = ...,
55
+ obj : str = ...,
56
+ ) -> None : ...
57
+ def assert_class_equal (
58
+ left : T , right : T , exact : bool | Literal ["equiv" ] = ..., obj : str = ...
59
+ ) -> None : ...
60
+ def assert_attr_equal (
61
+ attr : str , left : object , right : object , obj : str = ...
62
+ ) -> None : ...
63
+ def assert_is_valid_plot_return_object (
64
+ objs : Series | np .ndarray | Artist | tuple | dict ,
65
+ ) -> None : ...
66
+ def assert_is_sorted (seq : AnyArrayLike ) -> None : ...
28
67
def assert_categorical_equal (
29
- left ,
30
- right ,
68
+ left : Categorical ,
69
+ right : Categorical ,
31
70
check_dtype : bool = ...,
32
71
check_category_order : bool = ...,
33
72
obj : str = ...,
34
73
) -> None : ...
35
74
def assert_interval_array_equal (
36
- left , right , exact : str = ..., obj : str = ...
75
+ left : IntervalArray ,
76
+ right : IntervalArray ,
77
+ exact : bool | Literal ["equiv" ] = ...,
78
+ obj : str = ...,
79
+ ) -> None : ...
80
+ def assert_period_array_equal (
81
+ left : PeriodArray , right : PeriodArray , obj : str = ...
82
+ ) -> None : ...
83
+ def assert_datetime_array_equal (
84
+ left : DatetimeArray , right : DatetimeArray , check_freq : bool = ...
85
+ ) -> None : ...
86
+ def assert_timedelta_array_equal (
87
+ left : TimedeltaArray , right : TimedeltaArray , check_freq : bool = ...
37
88
) -> None : ...
38
- def assert_period_array_equal (left , right , obj : str = ...) -> None : ...
39
- def assert_datetime_array_equal (left , right , obj : str = ...) -> None : ...
40
- def assert_timedelta_array_equal (left , right , obj : str = ...) -> None : ...
41
89
def assert_numpy_array_equal (
42
90
left ,
43
91
right ,
44
92
strict_nan : bool = ...,
45
- check_dtype : bool = ...,
46
- err_msg = ...,
47
- check_same = ...,
93
+ check_dtype : bool | Literal [ "equiv" ] = ...,
94
+ err_msg : str | None = ...,
95
+ check_same : Literal [ "copy" , "same" ] | None = ...,
48
96
obj : str = ...,
49
- ): ...
97
+ index_values : Index | np .ndarray | None = ...,
98
+ ) -> None : ...
50
99
def assert_extension_array_equal (
51
- left ,
52
- right ,
53
- check_dtype : bool = ...,
54
- check_less_precise : bool = ...,
100
+ left : ExtensionArray ,
101
+ right : ExtensionArray ,
102
+ check_dtype : bool | Literal [ "equiv" ] = ...,
103
+ index_values : Index | np . ndarray | None = ...,
55
104
check_exact : bool = ...,
105
+ rtol : float = ...,
106
+ atol : float = ...,
107
+ obj : str = ...,
56
108
) -> None : ...
57
109
@overload
58
110
def assert_series_equal (
59
111
left : Series ,
60
112
right : Series ,
61
- check_dtype : bool = ...,
62
- check_index_type : bool | str = ...,
113
+ check_dtype : bool | Literal [ "equiv" ] = ...,
114
+ check_index_type : bool | Literal [ "equiv" ] = ...,
63
115
check_series_type : bool = ...,
64
116
check_names : bool = ...,
65
117
check_exact : bool = ...,
@@ -79,8 +131,8 @@ def assert_series_equal(
79
131
def assert_series_equal (
80
132
left : Series ,
81
133
right : Series ,
82
- check_dtype : bool = ...,
83
- check_index_type : bool | str = ...,
134
+ check_dtype : bool | Literal [ "equiv" ] = ...,
135
+ check_index_type : bool | Literal [ "equiv" ] = ...,
84
136
check_series_type : bool = ...,
85
137
check_names : bool = ...,
86
138
check_exact : bool = ...,
@@ -103,37 +155,34 @@ def assert_frame_equal(
103
155
check_index_type : bool | Literal ["equiv" ] = ...,
104
156
check_column_type : bool | Literal ["equiv" ] = ...,
105
157
check_frame_type : bool = ...,
106
- check_less_precise : int | bool = ...,
107
158
check_names : bool = ...,
108
159
by_blocks : bool = ...,
109
160
check_exact : bool = ...,
110
161
check_datetimelike_compat : bool = ...,
111
162
check_categorical : bool = ...,
112
163
check_like : bool = ...,
113
164
check_freq : bool = ...,
114
- check_flag : bool = ...,
165
+ check_flags : bool = ...,
115
166
rtol : float = ...,
116
167
atol : float = ...,
117
168
obj : str = ...,
118
169
) -> None : ...
119
170
def assert_equal (left , right , ** kwargs ) -> None : ...
120
- def assert_sp_array_equal (
121
- left ,
122
- right ,
123
- check_dtype : bool = ...,
124
- check_kind : bool = ...,
125
- check_fill_value : bool = ...,
126
- consolidate_block_indices : bool = ...,
127
- ) -> None : ...
128
- def assert_contains_all (iterable , dic ) -> None : ...
129
- def assert_copy (iter1 , iter2 , ** eql_kwargs ) -> None : ...
171
+ def assert_sp_array_equal (left : SparseArray , right : SparseArray ) -> None : ...
172
+ def assert_contains_all (iterable : Iterable [T ], dic : Container [T ]) -> None : ...
173
+ def assert_copy (iter1 : Iterable [T ], iter2 : Iterable [T ], ** eql_kwargs ) -> None : ...
174
+ @contextmanager
130
175
def assert_produces_warning (
131
- expected_warning = ...,
132
- filter_level : str = ...,
133
- clear = ...,
176
+ expected_warning : (
177
+ type [Warning ] | Literal [False ] | tuple [type [Warning ], ...] | None
178
+ ) = ...,
179
+ filter_level : Literal [
180
+ "error" , "ignore" , "always" , "default" , "module" , "once"
181
+ ] = ...,
134
182
check_stacklevel : bool = ...,
135
183
raise_on_extra_warnings : bool = ...,
136
- ) -> None : ...
184
+ match : str | None = None ,
185
+ ) -> Generator [list [warnings .WarningMessage ], None , None ]: ...
137
186
@contextmanager
138
187
def ensure_clean (
139
188
filename : str | None = ..., return_filelike : bool = ..., ** kwargs : Any
0 commit comments