Skip to content

Commit 4c50e0a

Browse files
Test moved from test_textreader to test_common
1 parent 019b3fa commit 4c50e0a

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

pandas/tests/io/parser/test_common.py

+13
Original file line numberDiff line numberDiff line change
@@ -2093,3 +2093,16 @@ def test():
20932093
parser.read_csv(path)
20942094

20952095
td.check_file_leaks(test)()
2096+
2097+
2098+
@pytest.mark.parametrize("nrows", range(1, 6))
2099+
def test_blank_lines_between_header_and_data_rows(all_parsers, nrows):
2100+
# GH 28071
2101+
ref = DataFrame(
2102+
[[np.nan, np.nan], [np.nan, np.nan], [1, 2], [np.nan, np.nan], [3, 4]],
2103+
columns=list("ab"),
2104+
)
2105+
csv = "\nheader\n\na,b\n\n\n1,2\n\n3,4"
2106+
parser = all_parsers
2107+
df = parser.read_csv(StringIO(csv), header=3, nrows=nrows, skip_blank_lines=False)
2108+
tm.assert_frame_equal(df, ref[:nrows])

pandas/tests/io/parser/test_textreader.py

-11
Original file line numberDiff line numberDiff line change
@@ -341,17 +341,6 @@ def test_empty_csv_input(self):
341341
df = read_csv(StringIO(), chunksize=20, header=None, names=["a", "b", "c"])
342342
assert isinstance(df, TextFileReader)
343343

344-
@pytest.mark.parametrize("nrows", range(1,6))
345-
def test_blank_lines_between_header_and_data_rows(self, nrows):
346-
# GH 28071
347-
ref = DataFrame(
348-
[[np.nan, np.nan], [np.nan, np.nan], [1, 2], [np.nan, np.nan], [3, 4]],
349-
columns=list("ab"),
350-
)
351-
csv = "\nheader\n\na,b\n\n\n1,2\n\n3,4"
352-
df = read_csv(StringIO(csv), header=3, nrows=nrows, skip_blank_lines=False)
353-
tm.assert_frame_equal(df, ref[:nrows])
354-
355344

356345
def assert_array_dicts_equal(left, right):
357346
for k, v in left.items():

0 commit comments

Comments
 (0)