11
11
12
12
from pandas import (Series , DataFrame , bdate_range ,
13
13
isna , compat , _np_version_under1p12 )
14
+ from pandas .errors import PerformanceWarning
14
15
from pandas .tseries .offsets import BDay
15
16
import pandas .util .testing as tm
16
17
import pandas .util ._test_decorators as td
@@ -1231,7 +1232,6 @@ def test_concat_axis1(self):
1231
1232
exp = pd .SparseDataFrame (exp )
1232
1233
tm .assert_sp_frame_equal (res , exp )
1233
1234
1234
- @pytest .mark .xfail (reason = "TODO" , strict = True )
1235
1235
def test_concat_different_fill (self ):
1236
1236
val1 = np .array ([1 , 2 , np .nan , np .nan , 0 , np .nan ])
1237
1237
val2 = np .array ([3 , np .nan , 4 , 0 , 0 ])
@@ -1240,12 +1240,14 @@ def test_concat_different_fill(self):
1240
1240
sparse1 = pd .SparseSeries (val1 , name = 'x' , kind = kind )
1241
1241
sparse2 = pd .SparseSeries (val2 , name = 'y' , kind = kind , fill_value = 0 )
1242
1242
1243
- res = pd .concat ([sparse1 , sparse2 ])
1243
+ with tm .assert_produces_warning (PerformanceWarning ):
1244
+ res = pd .concat ([sparse1 , sparse2 ])
1244
1245
exp = pd .concat ([pd .Series (val1 ), pd .Series (val2 )])
1245
1246
exp = pd .SparseSeries (exp , kind = kind )
1246
1247
tm .assert_sp_series_equal (res , exp )
1247
1248
1248
- res = pd .concat ([sparse2 , sparse1 ])
1249
+ with tm .assert_produces_warning (PerformanceWarning ):
1250
+ res = pd .concat ([sparse2 , sparse1 ])
1249
1251
exp = pd .concat ([pd .Series (val2 ), pd .Series (val1 )])
1250
1252
exp = pd .SparseSeries (exp , kind = kind , fill_value = 0 )
1251
1253
tm .assert_sp_series_equal (res , exp )
@@ -1263,20 +1265,21 @@ def test_concat_axis1_different_fill(self):
1263
1265
assert isinstance (res , pd .SparseDataFrame )
1264
1266
tm .assert_frame_equal (res .to_dense (), exp )
1265
1267
1266
- @pytest .mark .xfail (reason = "TODO" , strict = True )
1267
1268
def test_concat_different_kind (self ):
1268
1269
val1 = np .array ([1 , 2 , np .nan , np .nan , 0 , np .nan ])
1269
1270
val2 = np .array ([3 , np .nan , 4 , 0 , 0 ])
1270
1271
1271
1272
sparse1 = pd .SparseSeries (val1 , name = 'x' , kind = 'integer' )
1272
1273
sparse2 = pd .SparseSeries (val2 , name = 'y' , kind = 'block' , fill_value = 0 )
1273
1274
1274
- res = pd .concat ([sparse1 , sparse2 ])
1275
+ with tm .assert_produces_warning (PerformanceWarning ):
1276
+ res = pd .concat ([sparse1 , sparse2 ])
1275
1277
exp = pd .concat ([pd .Series (val1 ), pd .Series (val2 )])
1276
1278
exp = pd .SparseSeries (exp , kind = 'integer' )
1277
1279
tm .assert_sp_series_equal (res , exp )
1278
1280
1279
- res = pd .concat ([sparse2 , sparse1 ])
1281
+ with tm .assert_produces_warning (PerformanceWarning ):
1282
+ res = pd .concat ([sparse2 , sparse1 ])
1280
1283
exp = pd .concat ([pd .Series (val2 ), pd .Series (val1 )])
1281
1284
exp = pd .SparseSeries (exp , kind = 'block' , fill_value = 0 )
1282
1285
tm .assert_sp_series_equal (res , exp )
0 commit comments