Skip to content

Commit 1e8d5b2

Browse files
committed
Merge pull request #7625 from bwignall/depr_ru
CLN/DEPR: Fix instances of 'U'/'rU' in open(...)
2 parents 4c0cf67 + 4dd340e commit 1e8d5b2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas/io/tests/test_sql.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,13 @@ def _get_exec(self):
157157
return self.conn.cursor()
158158

159159
def _load_iris_data(self):
160+
import io
160161
iris_csv_file = os.path.join(tm.get_data_path(), 'iris.csv')
161162

162163
self.drop_table('iris')
163164
self._get_exec().execute(SQL_STRINGS['create_iris'][self.flavor])
164165

165-
with open(iris_csv_file, 'rU') as iris_csv:
166+
with io.open(iris_csv_file, mode='r', newline=None) as iris_csv:
166167
r = csv.reader(iris_csv)
167168
next(r) # skip header row
168169
ins = SQL_STRINGS['insert_iris'][self.flavor]

pandas/tests/test_series.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4249,11 +4249,12 @@ def test_from_csv(self):
42494249
assert_series_equal(checkseries, series)
42504250

42514251
def test_to_csv(self):
4252+
import io
42524253

42534254
with ensure_clean() as path:
42544255
self.ts.to_csv(path)
42554256

4256-
lines = open(path, 'U').readlines()
4257+
lines = io.open(path, newline=None).readlines()
42574258
assert(lines[1] != '\n')
42584259

42594260
self.ts.to_csv(path, index=False)

0 commit comments

Comments
 (0)