Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions tests/series/arithmetic/test_truediv.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import pandas as pd
from typing_extensions import assert_type

from tests import check
from tests import (
PD_LTE_23,
check,
)

left = pd.DataFrame({"a": [1, 2, 3]})["a"] # left operand

Expand Down Expand Up @@ -140,12 +143,24 @@ def test_truediv_pd_series() -> None:
check(assert_type(left.rdiv(c), pd.Series), pd.Series)


def test_path_div() -> None:
# GH 682
folder = Path.cwd()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same about the use of ensure_clean, the rest is good.


folders = pd.Series([folder, folder])
check(assert_type(folders / Path("a.png"), pd.Series), pd.Series, Path)


def test_truediv_path() -> None:
"""Test pd.Series / path object"""
left, p = pd.Series(["pat", "ath", "path"]), Path()
"""Test pd.Series / path object.

Also GH 682."""
left, p = pd.Series(["a.png", "b.gz", "c.txt"]), Path.cwd()

check(assert_type(left / p, pd.Series), pd.Series, Path)
check(assert_type(p / left, pd.Series), pd.Series, Path)
if PD_LTE_23:
# Bug in 3.0 https://github.com/pandas-dev/pandas/issues/61940
check(assert_type(p / left, pd.Series), pd.Series, Path)

check(assert_type(left.truediv(p), pd.Series), pd.Series, Path)
check(assert_type(left.div(p), pd.Series), pd.Series, Path)
Expand Down
12 changes: 0 additions & 12 deletions tests/series/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -3802,18 +3802,6 @@ def test_series_bool_fails() -> None:
pass


def test_path_div() -> None:
# GH 682
folder = Path.cwd()
files = pd.Series(["a.png", "b.png"])
if PD_LTE_23:
# Bug in 3.0 https://github.com/pandas-dev/pandas/issues/61940
check(assert_type(folder / files, pd.Series), pd.Series, Path)

folders = pd.Series([folder, folder])
check(assert_type(folders / Path("a.png"), pd.Series), pd.Series, Path)


def test_series_dict() -> None:
# GH 812
check(
Expand Down
Loading