File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -523,19 +523,14 @@ def test_timedeltas(self):
523
523
result = df .get_dtype_counts ().sort_values ()
524
524
assert_series_equal (result , expected )
525
525
526
- def test_illegal_arg_for_errors_in_astype (self ):
526
+ def test_arg_for_errors_in_astype (self ):
527
527
# issue #14878
528
528
529
529
df = DataFrame ([1 , 2 , 3 ])
530
530
531
531
with self .assertRaises (ValueError ):
532
532
df .astype (np .float64 , errors = True )
533
533
534
- def test_depr_kwarg_produces_future_warning (self ):
535
- # issue #14878
536
-
537
- df = DataFrame ([1 , 2 , 3 ])
538
-
539
534
with tm .assert_produces_warning (FutureWarning ):
540
535
df .astype (np .int8 , raise_on_error = False )
541
536
Original file line number Diff line number Diff line change @@ -168,3 +168,16 @@ def test_complexx(self):
168
168
b .real = np .arange (5 ) + 5
169
169
tm .assert_numpy_array_equal (a + 5 , b .real )
170
170
tm .assert_numpy_array_equal (4 * a , b .imag )
171
+
172
+ def test_arg_for_errors_in_astype (self ):
173
+ # issue #14878
174
+
175
+ sr = Series ([1 , 2 , 3 ])
176
+
177
+ with self .assertRaises (ValueError ):
178
+ sr .astype (np .float64 , errors = False )
179
+
180
+ with tm .assert_produces_warning (FutureWarning ):
181
+ sr .astype (np .int8 , raise_on_error = True )
182
+
183
+ sr .astype (np .int8 , errors = 'raise' )
You can’t perform that action at this time.
0 commit comments