Skip to content

Commit 2ec5eff

Browse files
committed
1 parent 935b475 commit 2ec5eff

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

tests/series/arithmetic/test_truediv.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import numpy as np
44
from numpy import typing as npt # noqa: F401
55
import pandas as pd
6+
from pandas._testing import ensure_clean
67
from typing_extensions import assert_type
78

89
from tests import (
@@ -145,25 +146,25 @@ def test_truediv_pd_series() -> None:
145146

146147
def test_path_div() -> None:
147148
# GH 682
148-
folder = Path.cwd()
149-
150-
folders = pd.Series([folder, folder])
151-
check(assert_type(folders / Path("a.png"), pd.Series), pd.Series, Path)
149+
with ensure_clean() as folder:
150+
folders = pd.Series([folder, folder])
151+
check(assert_type(folders / Path("a.png"), pd.Series), pd.Series, Path)
152152

153153

154154
def test_truediv_path() -> None:
155155
"""Test pd.Series / path object.
156156
157157
Also GH 682."""
158-
left, p = pd.Series(["a.png", "b.gz", "c.txt"]), Path.cwd()
158+
left = pd.Series(["a.png", "b.gz", "c.txt"])
159159

160-
check(assert_type(left / p, pd.Series), pd.Series, Path)
161-
if PD_LTE_23:
162-
# Bug in 3.0 https://github.com/pandas-dev/pandas/issues/61940
163-
check(assert_type(p / left, pd.Series), pd.Series, Path)
160+
with ensure_clean as p:
161+
check(assert_type(left / p, pd.Series), pd.Series, Path)
162+
if PD_LTE_23:
163+
# Bug in 3.0 https://github.com/pandas-dev/pandas/issues/61940
164+
check(assert_type(p / left, pd.Series), pd.Series, Path)
164165

165-
check(assert_type(left.truediv(p), pd.Series), pd.Series, Path)
166-
check(assert_type(left.div(p), pd.Series), pd.Series, Path)
166+
check(assert_type(left.truediv(p), pd.Series), pd.Series, Path)
167+
check(assert_type(left.div(p), pd.Series), pd.Series, Path)
167168

168-
check(assert_type(left.rtruediv(p), pd.Series), pd.Series, Path)
169-
check(assert_type(left.rdiv(p), pd.Series), pd.Series, Path)
169+
check(assert_type(left.rtruediv(p), pd.Series), pd.Series, Path)
170+
check(assert_type(left.rdiv(p), pd.Series), pd.Series, Path)

0 commit comments

Comments
 (0)