@@ -3139,10 +3139,6 @@ def test_to_csv_quotechar(self):
3139
3139
df .to_csv (path , quoting = 1 ) # 1=QUOTE_ALL
3140
3140
with open (path , 'r' ) as f :
3141
3141
self .assertEqual (f .read (), expected )
3142
- with tm .ensure_clean ('test.csv' ) as path :
3143
- df .to_csv (path , quoting = 1 , engine = 'python' )
3144
- with open (path , 'r' ) as f :
3145
- self .assertEqual (f .read (), expected )
3146
3142
3147
3143
expected = """\
3148
3144
$$,$col$
@@ -3154,17 +3150,10 @@ def test_to_csv_quotechar(self):
3154
3150
df .to_csv (path , quoting = 1 , quotechar = "$" )
3155
3151
with open (path , 'r' ) as f :
3156
3152
self .assertEqual (f .read (), expected )
3157
- with tm .ensure_clean ('test.csv' ) as path :
3158
- df .to_csv (path , quoting = 1 , quotechar = "$" , engine = 'python' )
3159
- with open (path , 'r' ) as f :
3160
- self .assertEqual (f .read (), expected )
3161
3153
3162
3154
with tm .ensure_clean ('test.csv' ) as path :
3163
3155
with tm .assertRaisesRegexp (TypeError , 'quotechar' ):
3164
3156
df .to_csv (path , quoting = 1 , quotechar = None )
3165
- with tm .ensure_clean ('test.csv' ) as path :
3166
- with tm .assertRaisesRegexp (TypeError , 'quotechar' ):
3167
- df .to_csv (path , quoting = 1 , quotechar = None , engine = 'python' )
3168
3157
3169
3158
def test_to_csv_doublequote (self ):
3170
3159
df = DataFrame ({'col' : ['a"a' , '"bb"' ]})
@@ -3178,18 +3167,11 @@ def test_to_csv_doublequote(self):
3178
3167
df .to_csv (path , quoting = 1 , doublequote = True ) # QUOTE_ALL
3179
3168
with open (path , 'r' ) as f :
3180
3169
self .assertEqual (f .read (), expected )
3181
- with tm .ensure_clean ('test.csv' ) as path :
3182
- df .to_csv (path , quoting = 1 , doublequote = True , engine = 'python' )
3183
- with open (path , 'r' ) as f :
3184
- self .assertEqual (f .read (), expected )
3185
3170
3186
3171
from _csv import Error
3187
3172
with tm .ensure_clean ('test.csv' ) as path :
3188
3173
with tm .assertRaisesRegexp (Error , 'escapechar' ):
3189
3174
df .to_csv (path , doublequote = False ) # no escapechar set
3190
- with tm .ensure_clean ('test.csv' ) as path :
3191
- with tm .assertRaisesRegexp (Error , 'escapechar' ):
3192
- df .to_csv (path , doublequote = False , engine = 'python' )
3193
3175
3194
3176
def test_to_csv_escapechar (self ):
3195
3177
df = DataFrame ({'col' : ['a"a' , '"bb"' ]})
@@ -3203,11 +3185,6 @@ def test_to_csv_escapechar(self):
3203
3185
df .to_csv (path , quoting = 1 , doublequote = False , escapechar = '\\ ' )
3204
3186
with open (path , 'r' ) as f :
3205
3187
self .assertEqual (f .read (), expected )
3206
- with tm .ensure_clean ('test.csv' ) as path :
3207
- df .to_csv (path , quoting = 1 , doublequote = False , escapechar = '\\ ' ,
3208
- engine = 'python' )
3209
- with open (path , 'r' ) as f :
3210
- self .assertEqual (f .read (), expected )
3211
3188
3212
3189
df = DataFrame ({'col' : ['a,a' , ',bb,' ]})
3213
3190
expected = """\
@@ -3220,10 +3197,6 @@ def test_to_csv_escapechar(self):
3220
3197
df .to_csv (path , quoting = 3 , escapechar = '\\ ' ) # QUOTE_NONE
3221
3198
with open (path , 'r' ) as f :
3222
3199
self .assertEqual (f .read (), expected )
3223
- with tm .ensure_clean ('test.csv' ) as path :
3224
- df .to_csv (path , quoting = 3 , escapechar = '\\ ' , engine = 'python' )
3225
- with open (path , 'r' ) as f :
3226
- self .assertEqual (f .read (), expected )
3227
3200
3228
3201
def test_csv_to_string (self ):
3229
3202
df = DataFrame ({'col' : [1 , 2 ]})
0 commit comments