Skip to content

Commit b7fa3b9

Browse files
Backport PR #56818 on branch 2.2.x (CI: Fix failing builds) (#56819)
Backport PR #56818: CI: Fix failing builds Co-authored-by: Thomas Li <[email protected]>
1 parent 59c0a2d commit b7fa3b9

File tree

2 files changed

+7
-27
lines changed

2 files changed

+7
-27
lines changed

pandas/tests/io/parser/common/test_chunksize.py

+4-13
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,9 @@ def test_chunks_have_consistent_numerical_type(all_parsers, monkeypatch):
220220
data = "a\n" + "\n".join(integers + ["1.0", "2.0"] + integers)
221221

222222
# Coercions should work without warnings.
223-
warn = None
224-
if parser.engine == "pyarrow":
225-
warn = DeprecationWarning
226-
depr_msg = "Passing a BlockManager to DataFrame|make_block is deprecated"
227-
with tm.assert_produces_warning(warn, match=depr_msg, check_stacklevel=False):
228-
with monkeypatch.context() as m:
229-
m.setattr(libparsers, "DEFAULT_BUFFER_HEURISTIC", heuristic)
230-
result = parser.read_csv(StringIO(data))
223+
with monkeypatch.context() as m:
224+
m.setattr(libparsers, "DEFAULT_BUFFER_HEURISTIC", heuristic)
225+
result = parser.read_csv(StringIO(data))
231226

232227
assert type(result.a[0]) is np.float64
233228
assert result.a.dtype == float
@@ -251,12 +246,8 @@ def test_warn_if_chunks_have_mismatched_type(all_parsers):
251246
buf = StringIO(data)
252247

253248
if parser.engine == "pyarrow":
254-
df = parser.read_csv_check_warnings(
255-
DeprecationWarning,
256-
"Passing a BlockManager to DataFrame is deprecated|"
257-
"make_block is deprecated",
249+
df = parser.read_csv(
258250
buf,
259-
check_stacklevel=False,
260251
)
261252
else:
262253
df = parser.read_csv_check_warnings(

pandas/tests/io/parser/common/test_read_errors.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,9 @@ def test_catch_too_many_names(all_parsers):
130130
else "Number of passed names did not match "
131131
"number of header fields in the file"
132132
)
133-
depr_msg = "Passing a BlockManager to DataFrame is deprecated"
134-
warn = None
135-
if parser.engine == "pyarrow":
136-
warn = DeprecationWarning
137133

138-
with tm.assert_produces_warning(warn, match=depr_msg, check_stacklevel=False):
139-
with pytest.raises(ValueError, match=msg):
140-
parser.read_csv(StringIO(data), header=0, names=["a", "b", "c", "d"])
134+
with pytest.raises(ValueError, match=msg):
135+
parser.read_csv(StringIO(data), header=0, names=["a", "b", "c", "d"])
141136

142137

143138
@skip_pyarrow # CSV parse error: Empty CSV file or block
@@ -168,13 +163,7 @@ def test_suppress_error_output(all_parsers):
168163
data = "a\n1\n1,2,3\n4\n5,6,7"
169164
expected = DataFrame({"a": [1, 4]})
170165

171-
warn = None
172-
if parser.engine == "pyarrow":
173-
warn = DeprecationWarning
174-
msg = "Passing a BlockManager to DataFrame|make_block is deprecated"
175-
176-
with tm.assert_produces_warning(warn, match=msg, check_stacklevel=False):
177-
result = parser.read_csv(StringIO(data), on_bad_lines="skip")
166+
result = parser.read_csv(StringIO(data), on_bad_lines="skip")
178167
tm.assert_frame_equal(result, expected)
179168

180169

0 commit comments

Comments
 (0)