13
13
14
14
import cudf
15
15
from cudf import Series
16
+ from cudf .core ._compat import PANDAS_GE_220
16
17
from cudf .core .buffer .spill_manager import get_global_manager
17
18
from cudf .core .index import as_index
18
19
from cudf .testing import _utils as utils
@@ -824,11 +825,21 @@ def test_operator_func_between_series_logical(
824
825
@pytest .mark .parametrize ("fill_value" , [None , 1.0 ])
825
826
@pytest .mark .parametrize ("use_cudf_scalar" , [False , True ])
826
827
def test_operator_func_series_and_scalar_logical (
827
- dtype , func , has_nulls , scalar , fill_value , use_cudf_scalar
828
+ request , dtype , func , has_nulls , scalar , fill_value , use_cudf_scalar
828
829
):
829
- gdf_series = utils .gen_rand_series (
830
- dtype , 1000 , has_nulls = has_nulls , stride = 10000
830
+ request .applymarker (
831
+ pytest .mark .xfail (
832
+ PANDAS_GE_220
833
+ and fill_value == 1.0
834
+ and scalar is np .nan
835
+ and (has_nulls or (not has_nulls and func not in {"eq" , "ne" })),
836
+ reason = "https://github.com/pandas-dev/pandas/issues/57447" ,
837
+ )
831
838
)
839
+ if has_nulls :
840
+ gdf_series = cudf .Series ([- 1.0 , 0 , cudf .NA , 1.1 ], dtype = dtype )
841
+ else :
842
+ gdf_series = cudf .Series ([- 1.0 , 0 , 10.5 , 1.1 ], dtype = dtype )
832
843
pdf_series = gdf_series .to_pandas (nullable = True )
833
844
gdf_series_result = getattr (gdf_series , func )(
834
845
cudf .Scalar (scalar ) if use_cudf_scalar else scalar ,
@@ -1684,16 +1695,6 @@ def test_scalar_null_binops(op, dtype_l, dtype_r):
1684
1695
assert result .dtype == valid_result .dtype
1685
1696
1686
1697
1687
- @pytest .mark .parametrize (
1688
- "date_col" ,
1689
- [
1690
- [
1691
- "2000-01-01 00:00:00.012345678" ,
1692
- "2000-01-31 00:00:00.012345678" ,
1693
- "2000-02-29 00:00:00.012345678" ,
1694
- ]
1695
- ],
1696
- )
1697
1698
@pytest .mark .parametrize ("n_periods" , [0 , 1 , - 1 , 12 , - 12 ])
1698
1699
@pytest .mark .parametrize (
1699
1700
"frequency" ,
@@ -1714,8 +1715,40 @@ def test_scalar_null_binops(op, dtype_l, dtype_r):
1714
1715
)
1715
1716
@pytest .mark .parametrize ("op" , [operator .add , operator .sub ])
1716
1717
def test_datetime_dateoffset_binaryop (
1717
- date_col , n_periods , frequency , dtype , op
1718
+ request , n_periods , frequency , dtype , op
1718
1719
):
1720
+ request .applymarker (
1721
+ pytest .mark .xfail (
1722
+ PANDAS_GE_220
1723
+ and dtype in {"datetime64[ms]" , "datetime64[s]" }
1724
+ and frequency == "microseconds"
1725
+ and n_periods == 0 ,
1726
+ reason = "https://github.com/pandas-dev/pandas/issues/57448" ,
1727
+ )
1728
+ )
1729
+ request .applymarker (
1730
+ pytest .mark .xfail (
1731
+ not PANDAS_GE_220
1732
+ and dtype in {"datetime64[ms]" , "datetime64[s]" }
1733
+ and frequency in ("microseconds" , "nanoseconds" )
1734
+ and n_periods != 0 ,
1735
+ reason = "https://github.com/pandas-dev/pandas/pull/55595" ,
1736
+ )
1737
+ )
1738
+ request .applymarker (
1739
+ pytest .mark .xfail (
1740
+ not PANDAS_GE_220
1741
+ and dtype == "datetime64[us]"
1742
+ and frequency == "nanoseconds"
1743
+ and n_periods != 0 ,
1744
+ reason = "https://github.com/pandas-dev/pandas/pull/55595" ,
1745
+ )
1746
+ )
1747
+ date_col = [
1748
+ "2000-01-01 00:00:00.012345678" ,
1749
+ "2000-01-31 00:00:00.012345678" ,
1750
+ "2000-02-29 00:00:00.012345678" ,
1751
+ ]
1719
1752
gsr = cudf .Series (date_col , dtype = dtype )
1720
1753
psr = gsr .to_pandas ()
1721
1754
@@ -1776,16 +1809,6 @@ def test_datetime_dateoffset_binaryop_multiple(date_col, kwargs, op):
1776
1809
utils .assert_eq (expect , got )
1777
1810
1778
1811
1779
- @pytest .mark .parametrize (
1780
- "date_col" ,
1781
- [
1782
- [
1783
- "2000-01-01 00:00:00.012345678" ,
1784
- "2000-01-31 00:00:00.012345678" ,
1785
- "2000-02-29 00:00:00.012345678" ,
1786
- ]
1787
- ],
1788
- )
1789
1812
@pytest .mark .parametrize ("n_periods" , [0 , 1 , - 1 , 12 , - 12 ])
1790
1813
@pytest .mark .parametrize (
1791
1814
"frequency" ,
@@ -1805,8 +1828,31 @@ def test_datetime_dateoffset_binaryop_multiple(date_col, kwargs, op):
1805
1828
["datetime64[ns]" , "datetime64[us]" , "datetime64[ms]" , "datetime64[s]" ],
1806
1829
)
1807
1830
def test_datetime_dateoffset_binaryop_reflected (
1808
- date_col , n_periods , frequency , dtype
1831
+ request , n_periods , frequency , dtype
1809
1832
):
1833
+ request .applymarker (
1834
+ pytest .mark .xfail (
1835
+ not PANDAS_GE_220
1836
+ and dtype in {"datetime64[ms]" , "datetime64[s]" }
1837
+ and frequency in ("microseconds" , "nanoseconds" )
1838
+ and n_periods != 0 ,
1839
+ reason = "https://github.com/pandas-dev/pandas/pull/55595" ,
1840
+ )
1841
+ )
1842
+ request .applymarker (
1843
+ pytest .mark .xfail (
1844
+ not PANDAS_GE_220
1845
+ and dtype == "datetime64[us]"
1846
+ and frequency == "nanoseconds"
1847
+ and n_periods != 0 ,
1848
+ reason = "https://github.com/pandas-dev/pandas/pull/55595" ,
1849
+ )
1850
+ )
1851
+ date_col = [
1852
+ "2000-01-01 00:00:00.012345678" ,
1853
+ "2000-01-31 00:00:00.012345678" ,
1854
+ "2000-02-29 00:00:00.012345678" ,
1855
+ ]
1810
1856
gsr = cudf .Series (date_col , dtype = dtype )
1811
1857
psr = gsr .to_pandas () # converts to nanos
1812
1858
0 commit comments