|
14 | 14 | import io
|
15 | 15 | import itertools
|
16 | 16 | from pathlib import Path
|
| 17 | +import platform |
17 | 18 | import string
|
18 | 19 | from typing import (
|
19 | 20 | TYPE_CHECKING,
|
@@ -1821,24 +1822,30 @@ def test_frame_getitem_isin() -> None:
|
1821 | 1822 | def test_to_excel() -> None:
|
1822 | 1823 | df = pd.DataFrame(data={"col1": [1, 2], "col2": [3, 4]})
|
1823 | 1824 |
|
1824 |
| - with ensure_clean() as path: |
1825 |
| - df.to_excel(path, engine="openpyxl") |
1826 |
| - check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
1827 |
| - with ensure_clean() as path: |
1828 |
| - df.to_excel(Path(path), engine="openpyxl") |
1829 |
| - check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
1830 |
| - with ensure_clean() as path: |
1831 |
| - df.to_excel(path, engine="openpyxl", startrow=1, startcol=1, header=False) |
1832 |
| - check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
1833 |
| - with ensure_clean() as path: |
1834 |
| - df.to_excel(path, engine="openpyxl", sheet_name="sheet", index=False) |
1835 |
| - check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
1836 |
| - with ensure_clean() as path: |
1837 |
| - df.to_excel(path, engine="openpyxl", header=["x", "y"]) |
1838 |
| - check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
1839 |
| - with ensure_clean() as path: |
1840 |
| - df.to_excel(path, engine="openpyxl", columns=["col1"]) |
1841 |
| - check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
| 1825 | + with pytest_warns_bounded( |
| 1826 | + DeprecationWarning, |
| 1827 | + match="datetime.datetime.utcnow", |
| 1828 | + lower="3.11", |
| 1829 | + version_str=platform.python_version(), |
| 1830 | + ): |
| 1831 | + with ensure_clean() as path: |
| 1832 | + df.to_excel(path, engine="openpyxl") |
| 1833 | + check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
| 1834 | + with ensure_clean() as path: |
| 1835 | + df.to_excel(Path(path), engine="openpyxl") |
| 1836 | + check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
| 1837 | + with ensure_clean() as path: |
| 1838 | + df.to_excel(path, engine="openpyxl", startrow=1, startcol=1, header=False) |
| 1839 | + check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
| 1840 | + with ensure_clean() as path: |
| 1841 | + df.to_excel(path, engine="openpyxl", sheet_name="sheet", index=False) |
| 1842 | + check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
| 1843 | + with ensure_clean() as path: |
| 1844 | + df.to_excel(path, engine="openpyxl", header=["x", "y"]) |
| 1845 | + check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
| 1846 | + with ensure_clean() as path: |
| 1847 | + df.to_excel(path, engine="openpyxl", columns=["col1"]) |
| 1848 | + check(assert_type(pd.read_excel(path), pd.DataFrame), pd.DataFrame) |
1842 | 1849 |
|
1843 | 1850 |
|
1844 | 1851 | def test_join() -> None:
|
|
0 commit comments