1
1
# -*- coding: utf-8 -*-
2
2
3
3
from warnings import catch_warnings
4
- import numpy as np
5
4
6
5
import pandas as pd
7
- from pandas .core import common as com
8
6
from pandas import api
9
- from pandas .api import types
10
7
from pandas .util import testing as tm
11
8
12
9
@@ -129,80 +126,6 @@ def test_api(self):
129
126
self .check (api , self .allowed )
130
127
131
128
132
- class TestTypes (Base , tm .TestCase ):
133
-
134
- allowed = ['is_any_int_dtype' , 'is_bool' , 'is_bool_dtype' ,
135
- 'is_categorical' , 'is_categorical_dtype' , 'is_complex' ,
136
- 'is_complex_dtype' , 'is_datetime64_any_dtype' ,
137
- 'is_datetime64_dtype' , 'is_datetime64_ns_dtype' ,
138
- 'is_datetime64tz_dtype' , 'is_datetimetz' , 'is_dtype_equal' ,
139
- 'is_extension_type' , 'is_float' , 'is_float_dtype' ,
140
- 'is_floating_dtype' , 'is_int64_dtype' , 'is_integer' ,
141
- 'is_integer_dtype' , 'is_number' , 'is_numeric_dtype' ,
142
- 'is_object_dtype' , 'is_scalar' , 'is_sparse' ,
143
- 'is_string_dtype' , 'is_signed_integer_dtype' ,
144
- 'is_timedelta64_dtype' , 'is_timedelta64_ns_dtype' ,
145
- 'is_unsigned_integer_dtype' , 'is_period' ,
146
- 'is_period_dtype' , 'is_re' , 'is_re_compilable' ,
147
- 'is_dict_like' , 'is_iterator' ,
148
- 'is_list_like' , 'is_hashable' ,
149
- 'is_named_tuple' , 'is_sequence' ,
150
- 'pandas_dtype' ]
151
-
152
- def test_types (self ):
153
-
154
- self .check (types , self .allowed )
155
-
156
- def check_deprecation (self , fold , fnew ):
157
- with tm .assert_produces_warning (DeprecationWarning ):
158
- try :
159
- result = fold ('foo' )
160
- expected = fnew ('foo' )
161
- self .assertEqual (result , expected )
162
- except TypeError :
163
- self .assertRaises (TypeError ,
164
- lambda : fnew ('foo' ))
165
- except AttributeError :
166
- self .assertRaises (AttributeError ,
167
- lambda : fnew ('foo' ))
168
-
169
- def test_deprecation_core_common (self ):
170
-
171
- # test that we are in fact deprecating
172
- # the pandas.core.common introspectors
173
- for t in self .allowed :
174
- self .check_deprecation (getattr (com , t ), getattr (types , t ))
175
-
176
- def test_deprecation_core_common_array_equivalent (self ):
177
-
178
- with tm .assert_produces_warning (DeprecationWarning ):
179
- com .array_equivalent (np .array ([1 , 2 ]), np .array ([1 , 2 ]))
180
-
181
- def test_deprecation_core_common_moved (self ):
182
-
183
- # these are in pandas.types.common
184
- l = ['is_datetime_arraylike' ,
185
- 'is_datetime_or_timedelta_dtype' ,
186
- 'is_datetimelike' ,
187
- 'is_datetimelike_v_numeric' ,
188
- 'is_datetimelike_v_object' ,
189
- 'is_datetimetz' ,
190
- 'is_int_or_datetime_dtype' ,
191
- 'is_period_arraylike' ,
192
- 'is_string_like' ,
193
- 'is_string_like_dtype' ]
194
-
195
- from pandas .types import common as c
196
- for t in l :
197
- self .check_deprecation (getattr (com , t ), getattr (c , t ))
198
-
199
- def test_removed_from_core_common (self ):
200
-
201
- for t in ['is_null_datelike_scalar' ,
202
- 'ensure_float' ]:
203
- self .assertRaises (AttributeError , lambda : getattr (com , t ))
204
-
205
-
206
129
class TestDatetoolsDeprecation (tm .TestCase ):
207
130
208
131
def test_deprecation_access_func (self ):
@@ -267,7 +190,7 @@ class TestLib(tm.TestCase):
267
190
def test_deprecation_access_func (self ):
268
191
with tm .assert_produces_warning (FutureWarning ,
269
192
check_stacklevel = False ):
270
- pd .lib .infer_dtype
193
+ pd .lib .infer_dtype ([ 'foo' ])
271
194
272
195
273
196
class TestTSLib (tm .TestCase ):
@@ -276,4 +199,4 @@ def test_deprecation_access_func(self):
276
199
# some libraries may be imported before we
277
200
# test and could show the warning
278
201
with catch_warnings (record = True ):
279
- pd .tslib .Timestamp
202
+ pd .tslib .Timestamp ( '20160101' )
0 commit comments