Skip to content

Commit e89a0a0

Browse files
gfyoungjreback
authored andcommitted
TST: Removed regex warning for read_csv
Follow-up to #13481 and partially fixes #13932. Regex mistakenly matches to the empty string, which will cause Python 3.x to issue a warning. In addition, not sure why this test was placed in `python_parsers_only.py`... Author: gfyoung <[email protected]> Closes #13943 from gfyoung/regex-empty-match and squashes the following commits: b93325e [gfyoung] TST: Removed regex warning for read_csv
1 parent 49f99ac commit e89a0a0

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pandas/io/tests/parser/common.py

+14
Original file line numberDiff line numberDiff line change
@@ -1568,3 +1568,17 @@ def _encode_data_with_bom(_data):
15681568
encoding=utf8, names=['a'],
15691569
skip_blank_lines=False)
15701570
tm.assert_frame_equal(out, expected)
1571+
1572+
def test_temporary_file(self):
1573+
# see gh-13398
1574+
data1 = "0 0"
1575+
1576+
from tempfile import TemporaryFile
1577+
new_file = TemporaryFile("w+")
1578+
new_file.write(data1)
1579+
new_file.flush()
1580+
new_file.seek(0)
1581+
1582+
result = self.read_csv(new_file, sep='\s+', header=None)
1583+
expected = DataFrame([[0, 0]])
1584+
tm.assert_frame_equal(result, expected)

pandas/io/tests/parser/python_parser_only.py

-14
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,6 @@ def test_read_table_buglet_4x_multiindex(self):
172172
actual = self.read_table(StringIO(data), sep='\s+')
173173
tm.assert_frame_equal(actual, expected)
174174

175-
def test_temporary_file(self):
176-
# GH13398
177-
data1 = "0 0"
178-
179-
from tempfile import TemporaryFile
180-
new_file = TemporaryFile("w+")
181-
new_file.write(data1)
182-
new_file.flush()
183-
new_file.seek(0)
184-
185-
result = self.read_csv(new_file, sep=r"\s*", header=None)
186-
expected = DataFrame([[0, 0]])
187-
tm.assert_frame_equal(result, expected)
188-
189175
def test_skipfooter_with_decimal(self):
190176
# see gh-6971
191177
data = '1#2\n3#4'

0 commit comments

Comments
 (0)