@@ -1333,18 +1333,25 @@ def test_sniff_delimiter(self):
1333
1333
sep = None , skiprows = 2 )
1334
1334
tm .assert_frame_equal (data , data3 )
1335
1335
1336
- # can't get this to work on Python 3
1337
- if not py3compat .PY3 :
1338
- text = u"""ignore this
1336
+
1337
+ text = u"""ignore this
1339
1338
ignore this too
1340
1339
index|A|B|C
1341
1340
foo|1|2|3
1342
1341
bar|4|5|6
1343
1342
baz|7|8|9
1344
1343
""" .encode ('utf-8' )
1345
- data4 = self .read_csv (BytesIO (text ), index_col = 0 , sep = None , skiprows = 2 ,
1346
- encoding = 'utf-8' )
1347
- tm .assert_frame_equal (data , data4 )
1344
+
1345
+ s = BytesIO (text )
1346
+ if py3compat .PY3 :
1347
+ # somewhat False since the code never sees bytes
1348
+ from io import TextIOWrapper
1349
+ s = TextIOWrapper (s , encoding = 'utf-8' )
1350
+
1351
+
1352
+ data4 = self .read_csv (s , index_col = 0 , sep = None , skiprows = 2 ,
1353
+ encoding = 'utf-8' )
1354
+ tm .assert_frame_equal (data , data4 )
1348
1355
1349
1356
def test_regex_separator (self ):
1350
1357
data = """ A B C D
@@ -1604,10 +1611,11 @@ def test_utf16_bom_skiprows(self):
1604
1611
with open (path , 'wb' ) as f :
1605
1612
f .write (bytes )
1606
1613
1614
+ s = BytesIO (dat .encode ('utf-8' ))
1607
1615
if py3compat .PY3 :
1608
- s = BytesIO ( dat . encode ( 'utf-8' ))
1609
- else :
1610
- s = StringIO ( dat . encode ( 'utf-8' ) )
1616
+ # somewhat False since the code never sees bytes
1617
+ from io import TextIOWrapper
1618
+ s = TextIOWrapper ( s , encoding = 'utf-8' )
1611
1619
1612
1620
result = self .read_csv (path , encoding = enc , skiprows = 2 ,
1613
1621
sep = sep )
0 commit comments