Skip to content

Commit 74f4f81

Browse files
committed
Fix test
1 parent 74e302f commit 74f4f81

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pandas/tests/io/excel/test_writers.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,13 @@ def test_to_excel_empty_frame(self, engine, ext):
13971397
expected = DataFrame()
13981398
tm.assert_frame_equal(result, expected)
13991399

1400+
def test_to_excel_raising_warning_when_cell_character_exceed_limit(self, path):
1401+
# GH#56954
1402+
df = DataFrame({"A": ["a" * 32768]})
1403+
msg = "String value too long, truncated to 32767 characters"
1404+
with tm.assert_produces_warning(UserWarning, match=msg):
1405+
df.to_excel(path)
1406+
14001407

14011408
class TestExcelWriterEngineTests:
14021409
@pytest.mark.parametrize(
@@ -1505,12 +1512,3 @@ def test_subclass_attr(klass):
15051512
attrs_base = {name for name in dir(ExcelWriter) if not name.startswith("_")}
15061513
attrs_klass = {name for name in dir(klass) if not name.startswith("_")}
15071514
assert not attrs_base.symmetric_difference(attrs_klass)
1508-
1509-
1510-
def test_to_excel_raising_warning_when_cell_character_exceed_limit():
1511-
# GH#56954
1512-
df = DataFrame({"A": ["a" * 32768]})
1513-
msg = "String value too long, truncated to 32767 characters"
1514-
with tm.assert_produces_warning(UserWarning, match=msg):
1515-
buf = BytesIO()
1516-
df.to_excel(buf)

0 commit comments

Comments
 (0)