Skip to content

Commit ea3f900

Browse files
author
nli307
committed
remove pyarrow tests from test_find_common_type, already covered by tests in test_arrow
1 parent a4f89dd commit ea3f900

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

pandas/tests/dtypes/cast/test_find_common_type.py

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import numpy as np
22
import pytest
33

4-
import pandas.util._test_decorators as td
5-
64
from pandas.core.dtypes.cast import find_common_type
75
from pandas.core.dtypes.common import pandas_dtype
86
from pandas.core.dtypes.dtypes import (
@@ -167,7 +165,6 @@ def test_interval_dtype(left, right):
167165
assert result == object
168166

169167

170-
@td.skip_if_no("pyarrow")
171168
@pytest.mark.parametrize("dtype", interval_dtypes)
172169
def test_interval_dtype_with_categorical(dtype):
173170
obj = Index([], dtype=dtype)
@@ -176,74 +173,3 @@ def test_interval_dtype_with_categorical(dtype):
176173

177174
result = find_common_type([dtype, cat.dtype])
178175
assert result == dtype
179-
180-
181-
@td.skip_if_no("pyarrow")
182-
@pytest.mark.parametrize(
183-
"dtypes,expected",
184-
[
185-
(
186-
["date32[pyarrow]", "null[pyarrow]"],
187-
"date32[day][pyarrow]",
188-
),
189-
(
190-
["date32[pyarrow]", "date32[pyarrow]"],
191-
"date32[day][pyarrow]",
192-
),
193-
(
194-
["date64[pyarrow]", "date64[pyarrow]"],
195-
"date64[ms][pyarrow]",
196-
),
197-
(
198-
["date32[pyarrow]", "date64[pyarrow]", "datetime64[ms]"],
199-
"timestamp[ms][pyarrow]",
200-
),
201-
],
202-
)
203-
def test_pyarrow_date_dtypes(dtypes, expected):
204-
source_dtypes = [pandas_dtype(dtype) for dtype in dtypes]
205-
result = find_common_type(source_dtypes)
206-
assert result == pandas_dtype(expected)
207-
208-
209-
@td.skip_if_no("pyarrow")
210-
@pytest.mark.xfail(
211-
reason="""
212-
Finding common pyarrow dtypes relies on conversion
213-
to numpy dtypes and then back to pyarrow dtypes.
214-
215-
We have:
216-
>>> pa.from_numpy_dtype(np.dtype('datetime64[D]'))
217-
DataType(date32[day])
218-
>>> pa.from_numpy_dtype(np.dtype('datetime64[ms]'))
219-
TimestampType(timestamp[ms])
220-
221-
To fix this test, we would need to have an exception
222-
that makes datetime64[ms] convert to date64[ms].
223-
224-
But date64 isn't the same as datetime64[ms]. date64
225-
is meant to represent a date (without time) only,
226-
represented in milliseconds (see
227-
https://github.com/apache/arrow/issues/15032#issuecomment-1368096718).
228-
229-
Hence, some date64-related common type computations
230-
end up becoming cast to timestamps rather than date64.
231-
"""
232-
)
233-
@pytest.mark.parametrize(
234-
"dtypes,expected",
235-
[
236-
(
237-
["date64[pyarrow]", "null[pyarrow]"],
238-
"date64[ms][pyarrow]",
239-
),
240-
(
241-
["date32[pyarrow]", "date64[pyarrow]"],
242-
"date64[ms][pyarrow]",
243-
),
244-
],
245-
)
246-
def test_pyarrow_date64_dtype(dtypes, expected):
247-
source_dtypes = [pandas_dtype(dtype) for dtype in dtypes]
248-
result = find_common_type(source_dtypes)
249-
assert result == pandas_dtype(expected)

0 commit comments

Comments
 (0)